1. 程式人生 > >如何更改nginx網站根目錄

如何更改nginx網站根目錄



預設網站根目錄為/usr/local/nginx/html,要將它改成/home/ftpUser/www
vi /usr/local/nginx/conf/nginx.conf 將其中的
        location / {             root   html;             index  index.php index.html index.htm;         } 改為
        location / {              root  /home/ftpUser/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/ftpUser/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