刚安装好nginx+php做事后,测试phpinfo页是否显示精确,却提示http 404缺点
nginx的缺点提示如下:
2019/08/14 11:25:27 [error] 119533#0: 6 FastCGI sent in stderr: \公众Primary script unknown\"大众 while reading response header from upstream, client: 192.168.0.62, server: , request: \"大众GET......
phpinfo.php文件
<?phpphpinfo();
缘故原由:
nginx和php的root根目录未设置对,如果代码都在同一目录下,可在server{}下设置全局root,不用单独在location{}里设置rootroot /main/web/www#其余/scripts 修正为 $document_rootlocation ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }