码迷,mamicode.com
首页 > Web开发 > 详细

更改nginx网站根目录

时间:2014-07-13 17:06:03      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:style   color   io   html   line   div   

默认网站根目录为/usr/local/nginx/html,要将它改成/homw/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
已经安装了samba,所以要将vi /etc/samba/smb.conf中的[public]下的path值改为
path = /home/www/

chown nginx.nginx /home/www/ -R  #设置目录所有者

chmod 700  /home/www/ -R   #设置目录权限



更改nginx网站根目录,布布扣,bubuko.com

更改nginx网站根目录

标签:style   color   io   html   line   div   

原文地址:http://blog.csdn.net/moqiang02/article/details/37728783

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!