nginx 如何访问php文件


1.进入nginx安装路径,我的是/usr/local/nginx
vi conf/nginx.conf

location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}

前面的#去掉

location / {
root html;
index index.php index.html index.htm;
}

index.html 前添加index.php
如果说访问nginx还是不能访问,请查看防火墙是否关闭,请关闭防火墙
将上面的fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
改为fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
(其中/usr/local/nginx   是你nginx安装的目录)




免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM