在nginx中更改服务器块的根目录?

我转移到一个更便宜的VPS主机,其中我的先前的configuration设置,以显示我的文件从/home/sam/www/website/index.html

但是我似乎无法在新服务器上发生这种情况,默认目录是/var/www/website/index.html

任何想在configuration上改变什么? 大多数是默认的

总是显示默认欢迎使用nginx html文件

server { listen 80; server_name samayres.net www.samayres.net; index index.html index.php index.htm; access_log /home/sam/www/samayres.net/logs/access_logs.log; error_log /home/sam/www/samayres.net/logs/error_logs.log; root /home/sam/www/samayres.net; error_page 401 /home/sam/www/samayres.net/error/401.html; error_page 403 /home/sam/www/samayres.net/error/403.html; error_page 404 /home/sam/www/samayres.net/error/404.html; error_page 500 /home/sam/www/samayres.net/error/500.html; error_page 501 /home/sam/www/samayres.net/error/501.html; error_page 502 /home/sam/www/samayres.net/error/502.html; error_page 503 /home/sam/www/samayres.net/error/503.html; error_page 504 /home/sam/www/samayres.net/error/504.html; location / { try_files $uri $uri/ /index.php?$args; } # rewrite adminpanel to use https rewrite ^/adminpanel(.*)$ https://$host$uri permanent; # Add trailing slash to */wp-admin requests. Needed if wordpress is installed later rewrite /wp-admin$ $scheme://$host$uri/ permanent; # Directives to send expires headers location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires 30d; } # Deny all attempts to access hidden files such as .htaccess, .htpasswd location ~ /\. { deny all; access_log off; log_not_found off; } location ~ \.php$ { try_files index index.php $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; } } 

在您的server {部分,更改:

 root /home/sam/www/website; 

至:

 root /var/www/website;