解决lnmp环境nginx无法解析php文件,html正常解析
lnmp环境nginx无法解析php文件,html正常解析。
出现nginx无法解析php显示404 Not Found
一键安装lnmp环境,内含nginx。
首先先安装php-fpm,
yum install php-fpm
service php-fpm start #启动 php-fpm
然后修改nginx配置文件nginx.conf 识别php
vi /usr/local/nginx/conf/nginx.conf 加一段代码
location ~ .php$ {
#fastcgi_split_path_info ^(.+.php)(/.+)$;
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;
include fastcgi_params;
#$document_root
}
最后重启nginx和php-fpm。
service nginx restart
service php-fpm restart
至此即可显示成功。
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇:没有了
