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

I have an nginx configuration where the virtual host keeps getting redirected to the localhost. I have tested and reloaded the configuration, /etc/hosts is doing the current name resolution, and I have cleared the browser cache.

This is my nginx.conf

user www-data www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
    worker_connections 1024;
    # multi_accept on;
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    gzip on;
    gzip_disable "msie6";

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}    

And this is my idu-lms.main config

server {  
    root        /var/www/wordpress/htdocs;  
    index       index.html index.php;  
    server_name idu-lms.main www.idu-lms.main;  
    error_log   /var/log/nginx/idu-lms.main.error.log;  
    access_log  /var/log/nginx/idu-lms.main.access.log;  

    location / {
        try_files   $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include     fastcgi_params;
        fastcgi_pass    unix:/var/run/php5-fpm.sock;
    }
}

and finally /etc/hosts

127.0.0.1   localhost
127.0.1.1   my-virtual-machine
127.0.0.1   idu-lms.main
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

There are no redirects in your nginx configuration, so it is most likely that the application (WordPress) is sending the redirect.

If you accidentally set up WordPress with the URL of http://localhost/ then it will always attempt to redirect to localhost. In this case, you will need to change the URL that WordPress uses.

share|improve this answer
    
Thanks, I think I just fixed that problem. It seemed like there was an additional wp-config.php somewhere that's causing nginx to look elsewhere. After deleting it, it was good to go. But unfortunately, I think I broke the configuration again when I thought it would be nice to rename the folder where wordpress is served (idu-lms.main updated as well). It now shows me the white screen of death. Should I open another thread for this? –  Angela Mar 1 '13 at 7:15
    
It definitely sounds like a different question. :) –  Michael Hampton Mar 1 '13 at 7:16
    
Can you help me take a look at it? Thanks. serverfault.com/questions/483669/… –  Angela Mar 1 '13 at 7:22
add comment

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.