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 have nginx running on Raspbian and I'm trying to add another server block alongside the default one. I have two files default and blog.mydomain.com where mydomain is obviously my own domain. In the default file I have:

http://pastebin.com/bVWSLMf5

This works fine, and when I visit via mydomain.com via 8080 I get the standard '

Welcome to nginx!

The second file, blog.mydomain.com is:

http://pastebin.com/PtCECSE4

When I visit http://blog.mydomian.com:8080 I get the default welcome message again. I have something in the folder (a wordpress install which I have been hosting elsewhere), so I'm really not sure why I'm not seeing it?

share|improve this question
    
Where are the 2 files you mentioned? Have you enabled the sites and relaoded nginx? –  xofer May 31 '13 at 15:42
    
They're in /etc/nginx/sites-available with symlinks in /etc/nginx/sites-enabled –  sgtbeano May 31 '13 at 15:49

2 Answers 2

You may want to try specifying a server_name in your first server block. I suspect something is happening in the server name mapping so that both names are resolving to the same root.

See: http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name

For more info on server names.

share|improve this answer
    
I've added dev.mydomain.com to the default server block, and wierdly it points directs me to a site on another server I'm hosting..... seriously considering moving back to apache at this point :P –  sgtbeano May 31 '13 at 16:05
    
That sounds like a DNS issue. –  jeffatrackaid May 31 '13 at 16:34

Okay, so weirdly if I combine the two files together inside default it works as expected. For reference I now have this in a single file:

http://pastebin.com/hVJLTHBv

share|improve this answer
    
In you main nginx.conf file, what include statements are there? Perhaps only the default file and not the entire directory was being included. –  jeffatrackaid May 31 '13 at 16:33
    
I checked and include /etc/nginx/sites-enabled/*; is in there. –  sgtbeano May 31 '13 at 18:48

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.