更改nginx網站根目錄

默認網站根目錄爲/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;
        }

已經安裝了samba,所以要將vi /etc/samba/smb.conf中的[public](在配置文件的最下面)下的path值改爲
path = /home/www/

最後然後重啓nginx
搞定!
發佈了71 篇原創文章 · 獲贊 124 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章