更改nginx网站根目录

来源:互联网 发布:长春学历网络教育报名 编辑:程序博客网 时间:2024/05/22 17:43

原文地址:http://blog.sina.com.cn/s/blog_5d15305b0101c7s2.html


认网站根目录为/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/
0 0