一.问题:访问页面显示
二.过程描述:
配置nginx
server { listen 80; server_name 10.0.0.8; index index.php; location / { root /html/www/wordpress; } 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; } }
三.处理过程:
方法一:在匹配php页面规则里加上站点目录
server { listen 80; server_name 10.0.0.8; index index.php; location / { root /html/www/wordpress; } location ~ \.php$ { root /html/www/wordpress; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
方法二:将$document_root替换成根目录/html/www/wordpress
server { listen 80; server_name 10.0.0.8; index index.php; location / { root /html/www/wordpress; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /html/www/wordpress$fastcgi_script_name; include fastcgi_params; } }
四.原因:
使用php-fpm解析PHP,出现”No input file specified”,”File not found”错误,原因是php-fpm进程找不到SCRIPT_FILENAME配置的要执行的.php文件,php-fpm返回给nginx的默认404错误提示
赞赏微信赞赏
支付宝赞赏