更改nginx默认服务目录

来源:互联网 发布:dota选手知乎 编辑:程序博客网 时间:2024/06/05 07:32

系统:CentOS Linux release 7.2.1511 (Core)

安装nginx:yum install nginx

查看nginx服务目录:

配置文件:nginx.conf 服务文件为:index.html

默认网站根目录为/usr/share/nginx/html,要将它改成/usr/share/nginx/html/test

vi /usr/local/nginx/conf/nginx.conf
将其中的

        location / {
            
        }
改为

        location / {
            root   /usr/share/nginx/html/test
            
        }
重启nginx,然后部署html等相关文件。重新加载(reload)即可。静态页面不需要重启nginx。

nginx安装文章参看:狠狠戳!
0 0