Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Jun 02, 2011 11:03 am 
Offline
Newbie

Joined: Thu Jun 02, 2011 9:10 am
Posts: 3
I just started a linode server, and I seem to have an issue where no matter what domain name I put into a website (that is registered with linode in the DNS manager), nginx always returns the same website for the virtual server HOST_A (or whatever happens to be the first parsable hostname when I messed around with it). I have been trying to fix this for a couple of hours, but I have no idea if this is due to the way I have my dns set up or due to nginx (however at this point I am leaning towards the former)

I have 5 separate domains hosted on godaddy, all which I have put in the DNS manager using this guide http://www.linode.com/wiki/index.php/Linode_DNS. I just updated the nameservers at godaddy with
ns1.linode.com
ns2.linode.com
ns3.linode.com
ns4.linode.com
ns5.linode.com

The linode OS I use is archlinux, and I put the same hostname in /etc/rc.conf, /etc/hosts and /etc/rc.d/conf


Code:
    server {
        listen       80;
        server_name  HOST_A;

        location / {
           root   PATH_A;
           index  index.html index.htm;
        }
    }

    server {
        listen       80;
        server_name HOST_B;

        location / {
            root   PATH_B;
            index  index.html index.htm;
        }
    }

    server {
        listen       80;
        server_name HOST_C;

        location / {
            root   PATH_C;
            index  index.html index.htm;
        }
    }

    server {
        listen       80;
        server_name HOST_D;

        location / {
            root  PATH_D;
            index  index.html index.htm;
        }
    }

    server {
        listen       80;
        server_name HOST_E;

        location / {
            root   PATH_E;
            index  index.html index.htm;
        }
    }


If I comment out every single server bar one, then it works fine, otherwise it always defaults to the first parsed server

Log files for nginx don't show anything

I think this may be a DNS issue, where the hostname isn't actually being sent to nginx, but instead an IP

To be sure, one doesn't actually require an FQDN for the site to work in /etc/hosts (I have multiple seperate domains hosted on the same site)?. Is the FQDN also something you completely make up?

Any ideas?


Top
   
 Post subject:
PostPosted: Thu Jun 02, 2011 11:24 am 
Offline
Senior Member

Joined: Fri Dec 10, 2010 6:21 am
Posts: 144
I can't really solve the problem but I can rule out a few things.

The role DNS serves in terms of web browsing is only to translate the "host" part of the URL (if it's not already an IP) to an IP address, which is what can actually be connected to.

What the browser sends to the web server as the Host header depends only on the URL in the location field in the browser.


If you're saying that you do get contact with your server, and specifically nginx running on it, for all those domains, then it would not seem to be a DNS issue.


Can you give actual real-world examples, maybe that would give a better idea of what is going on?


Top
   
 Post subject:
PostPosted: Thu Jun 02, 2011 11:32 am 
Offline
Newbie

Joined: Thu Jun 02, 2011 9:10 am
Posts: 3
Well the real world example is, that with the config file above, whenever someone puts HOST_A, HOST_B, HOST_C, HOST_D, HOST_E into their browser, it always directs to HOST_A.

If I happen to comment out HOST_A (so I just have HOST_B,HOST_C,HOST_D, HOST_E) then it just directs to HOST_B


Top
   
 Post subject:
PostPosted: Thu Jun 02, 2011 11:36 am 
Offline
Senior Member

Joined: Fri Dec 10, 2010 6:21 am
Posts: 144
deteego wrote:
Well the real world example is, that with the config file above, whenever someone puts HOST_A, HOST_B, HOST_C, HOST_D, HOST_E into their browser, it always directs to HOST_A.

If I happen to comment out HOST_A (so I just have HOST_B,HOST_C,HOST_D, HOST_E) then it just directs to HOST_B


When you say "directs to", does it mean that nginx simply serves the content that belongs to the other site or is the browser redirected to the other address?

(Do you have any rewrite rules in place?)


Still, real-world examples would help for anyone but you to actually have a chance of looking at it.


Top
   
 Post subject:
PostPosted: Thu Jun 02, 2011 11:46 am 
Offline
Newbie

Joined: Thu Jun 02, 2011 9:10 am
Posts: 3
Yes I mean that nginx just serves the content of that site

Although something is weird is happening now, some sites just randomly started working (although not all).

I started refreshing the pages in realtime, and they started working (without even updating the nginx config file). I think it really was the DNS updating, I was about to post that every site works except for one, however they all now work! (hence the comment above ;) )

Although as you said, that is odd, if the DNS doesn't update probably it shouldn't reach my linode server at ALL


Top
   
 Post subject:
PostPosted: Thu Jun 02, 2011 11:51 am 
Offline
Senior Member

Joined: Fri Dec 10, 2010 6:21 am
Posts: 144
Based on your description I don't really think it was DNS, possibly browser cache if your nginx configuration was different originally.

Great that it works, nonetheless!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group