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