当前位置:首页 > 服务器技术 > nginx

nginx修改网站根目录

默认网站根目录为/usr/local/nginx/html,要将它改成/home/www

vi /usr/local/nginx/conf/nginx.conf

将其中的

location / {

root html;

index index.php index.html index.htm;

}

改为

location / {

root /home/www;

index index.php index.html index.htm;

}

然后再将

location ~ .php$ {

root html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

改为

location ~ .php$ {

root /home/www;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

以上就介绍了nginx 修改网站根目录,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!