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安裝的目錄)