yama@jpx20120007:/var/www/html$ cat /etc/lsb-release DISTRIB_ID=LinuxMint DISTRIB_RELEASE=3 DISTRIB_CODENAME=cindy DISTRIB_DESCRIPTION="LMDE 3 Cindy"
の環境で、nginx 経由で、php を使おうと、
https://qiita.com/tukiyo3/items/b1d29a257c41d97d6107
を参考に、設定してみたのですが、
yama@jpx20120007:/var/www/html$ php a.php hoge
を、Chrome Browserより、
http://localhost/a.php
でアクセスすると、
ブラウザ上に、hoge と表示されず、
a.php の "ファイルを保存" のダイアログが表示され、
保存すると、a.php のファイルそのものが保存されます。
a.phpのファイルの保存ダイアログが開くということは、
yama@jpx20120007:/etc/nginx/sites-enabled$ grep root default root /var/www/html; # deny access to .htaccess files, if Apache's document root # root /var/www/example.com;
の root /var/www/html は、nginxが、正しく認識されていると思っています。
設定のどこが悪いのかご教示頂けますでしょうか?
ちなみに、http://localhost/a.php でアクセス時、
nginx の logerror.log は何も出力されず。
access.log は、下記が出力されました。
yama@jpx20120007:~$ tail --lines=0 -f /var/log/nginx/access.log ::1 - - [26/Dec/2018:14:44:44 +0900] "GET /a.php HTTP/1.1" 200 19 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
となります。
nginx の設定/動作確認と、php-fpm の設定/動作確認は、下記になります。
■nginxの設定/動作確認 yama@jpx20120007:/etc/nginx$ grep -e user -e include -e log /etc/nginx/nginx.conf user www-data; include /etc/nginx/modules-enabled/*.conf; include /etc/nginx/mime.types; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; yama@jpx20120007:/etc/nginx/conf.d$ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successf yama@jpx20120007:~$ grep www-data /etc/passwd /etc/group /etc/passwd:www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin /etc/group:www-data:x:33: yama@jpx20120007:~$ sudo systemctl status nginx ● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2018-12-26 03:03:50 JST; 11h ago Docs: man:nginx(8) Process: 826 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Process: 683 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS) Main PID: 828 (nginx) Tasks: 133 (limit: 4915) CGroup: /system.slice/nginx.service ├─828 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; ├─829 nginx: worker process ├─830 nginx: worker process ├─831 nginx: worker process └─832 nginx: worker process 12月 26 03:03:45 jpx20120007.ifs.sony.co.jp systemd[1]: Starting A high performance web server and a reverse proxy server... 12月 26 03:03:50 jpx20120007.ifs.sony.co.jp systemd[1]: Started A high performance web server and a reverse proxy server. yama@jpx20120007:~$ ps aux | grep nginx root 828 0.0 0.0 159516 1696 ? Ss 12月25 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; www-data 829 0.0 0.1 424676 6944 ? Sl 12月25 0:05 nginx: worker process www-data 830 0.0 0.1 424676 6944 ? Sl 12月25 0:00 nginx: worker process www-data 831 0.0 0.1 424676 6944 ? Sl 12月25 0:05 nginx: worker process www-data 832 0.0 0.1 424676 6944 ? Sl 12月25 0:04 nginx: worker process yama 9913 0.0 0.0 12264 976 pts/0 S+ 14:12 0:00 grep nginx ■php-fpm の設定/動作確認 yama@jpx20120007:~$ grep -e "^include" -e "^error" /etc/php/7.0/fpm/php-fpm.conf error_log = /var/log/php7.0-fpm.log include=/etc/php/7.0/fpm/pool.d/*.conf yama@jpx20120007:~$ grep -e "^user" -e "^group" -e "^listen" /etc/php/7.0/fpm/pool.d/www.conf user = www-data group = www-data listen = /run/php/php7.0-fpm.sock listen.owner = www-data listen.group = www-data listen.mode = 0660 yama@jpx20120007:~/sitebar$ ls -l /run/php/php7.0-fpm.sock srw-rw---- 1 www-data www-data 0 12月 26 03:03 /run/php/php7.0-fpm.sock yama@jpx20120007:~$ sudo systemctl status php7.0-fpm [sudo] yama のパスワード: ● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2018-12-26 03:03:47 JST; 11h ago Docs: man:php-fpm7.0(8) Main PID: 680 (php-fpm7.0) Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec" Tasks: 3 (limit: 4915) CGroup: /system.slice/php7.0-fpm.service ├─680 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf) ├─715 php-fpm: pool www └─716 php-fpm: pool www 12月 26 03:03:45 jpx20120007.ifs.sony.co.jp systemd[1]: Starting The PHP 7.0 FastCGI Process Manager... 12月 26 03:03:47 jpx20120007.ifs.sony.co.jp systemd[1]: Started The PHP 7.0 FastCGI Process Manager.
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。