Nginx : PHP-FPM2015/08/26 |
|
PHP-FPM ( PHP FastCGI Process Manager ) をインストールし、Nginx で PHP スクリプトが利用できるよう設定します。
|
|
| [1] | PHP および PHP-FPM をインストールします。 |
|
[root@www ~]# yum -y install php php-mbstring php-pear php-fpm
|
| [2] | PHP-FPM と Nginx の設定です。 |
|
[root@www ~]#
vi /etc/php-fpm.d/www.conf # 39行目:変更 user = nginx # 41行目:変更 group = nginx
[root@www ~]#
vi /etc/nginx/nginx.conf # server セクション内に追記
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
systemctl restart nginx |
| [3] | PHPInfo を作成して PHP の動作確認をしてください。以下のようなページが表示されれば OK です。 |
|
[root@www ~]# echo "<?php phpinfo() ?>" > /usr/share/nginx/html/info.php |
|
| Sponsored Link |
|
|