我已经在OS X EL CAPITAN上安装了nginx,php-fpm和OS X EL CAPITAN 。 我用ps命令来检查nginx和fpm是否在运行。
我已经将下面的代码块添加到nginX的server块中:
location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
nginx听8080和fpm 9000 。 我用lsof命令来检查:
php-fpm 22903 root 0u IPv4 0x5a9bc9209264e227 0t0 TCP 127.0.0.1:9000 (LISTEN) php-fpm 22904 fc 0u IPv4 0x5a9bc9209264e227 0t0 TCP 127.0.0.1:9000 (LISTEN) nginx 22931 fc 6u IPv4 0x5a9bc9208c304cc7 0t0 TCP *:8080 (LISTEN) nginx 22932 fc 6u IPv4 0x5a9bc9208c304cc7 0t0 TCP *:8080 (LISTEN)
有关nginx下载php文件而不是解释它们的问题的任何线索?
EDIT1:
完整的nginXconfiguration:
http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 8080; server_name localhost; location / { root html; index index.html index.htm; } location ~ \.php$ { root /usr/local/var/www/; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; } } include servers/*;
我提取的URL是: http://localhost:8080/info.php
有没有人有任何线索关于这个问题? 我在stackoverflow每个问题都没有成功:
http://serverfault.com/questions/563285/nginx-with-php-fpm-downloading-php-files-rather-than-executing-them-on-mac-os-x?rq=1 http://serverfault.com/questions/412079/nginx-php-fpm-php-file-not-found-cant-figure-out-why?rq=1
我刚刚改变了下面的行:
fastcgi_param SCRIPT_FILENAME $scripts$fastcgi_script_name;
至:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
它现在有效。