nginx 修改网站的根目录
一般nginx网站根目录在nginx.conf中配置
下图说明网站根目录在安装目录下的html目录

安装目录查找:whereis nginx

修改网站根目录,就需要修改 location /下的root
location / {
root /home/nginx/html;
index index.html index.htm;
}
如果location ~ .php$ 没有被屏蔽也需要修改root
location ~ .php$ {
root /home/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
修改后重启nginx生效
转载请记录来源!!!!
https://www.cnblogs.com/leihongnu/

浙公网安备 33010602011771号