nginx1.11と PHP7.0, PHP-FPMを連携して動かす。
それぞれのインストール方法は下記を参照。
CentOS7にyumでPHP7, PHP-FPM, OPcache, APCuをインストール
PHPを最低限動かす設定
nginx1.11のデフォルトの設定では、「/usr/share/nginx/html」が公開ディレクトリ。
ここにphpファイルを置いて、アクセスできるようにする。
sudo vim /usr/share/nginx/html/index.php
<?php echo phpinfo();
nginxの設定を修正。
sudo vim /etc/nginx/conf.d/default.conf
「location ~ \.php$」ディレクティブで、PHPファイルに対する設定をおこなう。
nginxの設定ファイルに最初から書かれているので、コメントアウトを外し、rootディレクトリと fastcgi_paramを修正する。
location ~ \.php$ { #root html; root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; include fastcgi_params; }
php-fpm側の修正。
sudo vim /etc/php-fpm.d/www.conf
こっちはuserとgroupをapacheからnginxへ修正するだけでいい。
;user = apache user = nginx ;group = apache group = nginx
再起動する。
sudo systemctl restart nginx sudo systemctl restart php-fpm
IPアドレス直指定して、作成したPHPファイルにアクセスできれば連携はできるようになっている。

2022 XXX Directory: Sex, Porn & XXX Cam Sites Listing
XXX.xxx is the world's leading free porn directory. Choose from thousands of hardcore sex sites with streaming video, high quality photos and live sex cam.
astCGI sent in stderr: “Primary script unknown” while reading response header from upstream
下記のように、rootをコメントアウトしただけだとエラーが出るぞ。
location ~ \.php$ { #root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; include fastcgi_params; }
コメント