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

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   localhost   my-virtual-machine   idu-lms.main
share|improve this question
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.… – Angela Mar 1 '13 at 7:22

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.