Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I moved to a cheaper VPS host in which my prior config was set up to display my files from /home/sam/www/website/index.html

But I can't seem to get this to happen on the new server, the default directory is /var/www/website/index.html

Any ideas on what to change on the config? The majority is default

always displays default welcome to nginx html file

server {
    listen 80;

    index index.html index.php index.htm;

    access_log /home/sam/www/;
    error_log /home/sam/www/;
    root /home/sam/www/;
    error_page 401 /home/sam/www/;
    error_page 403 /home/sam/www/;
    error_page 404 /home/sam/www/;
    error_page 500 /home/sam/www/;
    error_page 501 /home/sam/www/;
    error_page 502 /home/sam/www/;
    error_page 503 /home/sam/www/;
    error_page 504 /home/sam/www/;

    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_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;

share|improve this question
Are you saying that the old provider used a directory tree of /home/sam/www/website/, while the new provider is /var/www/website/? – Shane Madden May 24 '13 at 15:32
What is the problem you are having? – Michael Hampton May 24 '13 at 16:29
@MichaelHampton The default directory is /var/www/ and I can't seem to change it using the server block – samayres1992 May 24 '13 at 16:52
@ShaneMadden correct, sorry I didn't make that clear, I edited the post now. it's displaying the default nginx index.html even though there is a server block stating another directory. – samayres1992 May 24 '13 at 16:53
Your config looks fine. Did you reload nginx? Did you fix your DNS? – Michael Hampton May 24 '13 at 16:54
up vote 3 down vote accepted

In your server { section, change:

root /home/sam/www/website;


root /var/www/website;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.