您的位置:首页 > 运维架构 > Linux

Centos6.x/7.x LNMP 环境安装常见错误集锦

2015-09-12 16:05 471 查看
访问php文件,不能解析或直接下载,nginx.conf中如下配置不正确或未配置

userwwwwww;

 

index index.phpindex.htmlindex.htm; 

 

#
pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

 

#

#取消FastCGI
server部分location的注释,注意fastcgi_param行的参数,改为$document_root$fastcgi_script_name,或者使用绝对路径

location~\.php${

roothtml;

fastcgi_pass127.0.0.1:9000;

fastcgi_indexindex.php;

fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;

includefastcgi_params;

}

访问php文件,nginx对PHP文件报File not found 错误

错误原因:配置文件 nginx.conf 中

userwwwwww;

 

index index.phpindex.htmlindex.htm; 

 

#
pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

 

#

#取消FastCGI
server部分location的注释,注意fastcgi_param行的参数,改为$document_root$fastcgi_script_name,或者使用绝对路径

location~\.php${

roothtml;

fastcgi_pass127.0.0.1:9000;

fastcgi_indexindex.php;

fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;

includefastcgi_params;

}

fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

改成如下这句,即可

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: