nginxでPHPを動かす
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[nginx]]
*概要 [#dbc6d8d4]
nginxでPHPを動かす方法です。~
いくつかあるようですが、php-fpmでの方法を記載します。
*内容 [#i5b36c34]
***1.remiまたはepelのリポジトリを導入する。 [#ib0137b6]
***2.php-fpmをインストール [#jb55a762]
# yum install php-fpm
# php-fpm -v
PHP 5.3.3 (fpm-fcgi) (built: Dec 11 2013 03:32:01)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technol...
# /etc/init.d/php-fpm start
php-fpm を起動中: ...
# chkconfig php-fpm on
# chkconfig php-fpm --list
php-fpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off
***3.nginxでphpをCGIとして稼働するように設定する。 [#n0f0...
# cd /etc/nginx/conf.d/
# vi server.conf
以下のコメントアウトを解除
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcg...
# include fastcgi_params;
#}
↓
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /ドキュメントル...
include fastcgi_params;
}
# /etc/init.d/nginx configtest
nginx: the configuration file /etc/nginx/nginx.conf synt...
nginx: configuration file /etc/nginx/nginx.conf test is ...
# service nginx restart
***4.テスト [#pd08ab79]
# cd ドキュメントルート
# vi phpinfo.php
<?php
phpinfo();
?>
終了行:
[[nginx]]
*概要 [#dbc6d8d4]
nginxでPHPを動かす方法です。~
いくつかあるようですが、php-fpmでの方法を記載します。
*内容 [#i5b36c34]
***1.remiまたはepelのリポジトリを導入する。 [#ib0137b6]
***2.php-fpmをインストール [#jb55a762]
# yum install php-fpm
# php-fpm -v
PHP 5.3.3 (fpm-fcgi) (built: Dec 11 2013 03:32:01)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technol...
# /etc/init.d/php-fpm start
php-fpm を起動中: ...
# chkconfig php-fpm on
# chkconfig php-fpm --list
php-fpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off
***3.nginxでphpをCGIとして稼働するように設定する。 [#n0f0...
# cd /etc/nginx/conf.d/
# vi server.conf
以下のコメントアウトを解除
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcg...
# include fastcgi_params;
#}
↓
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /ドキュメントル...
include fastcgi_params;
}
# /etc/init.d/nginx configtest
nginx: the configuration file /etc/nginx/nginx.conf synt...
nginx: configuration file /etc/nginx/nginx.conf test is ...
# service nginx restart
***4.テスト [#pd08ab79]
# cd ドキュメントルート
# vi phpinfo.php
<?php
phpinfo();
?>
ページ名: