Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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;
    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;
             }

}
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

1 Answer 1

In your server { section, change:

root /home/sam/www/website;

to:

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

Your Answer

 
discard

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.