1

I have multiple files each with a config for a different vhost. On one of these config files (included in the main nginx config file) I set the default_server directive:

server { listen 80; listen 443 ssl default_server spdy; server_name 188.166.X.XXX; root /var/www/default; index index.php index.html; ... } 

... but it's not respected. If I point the A record of a domain I didn't add in a nginx server block, the first server block in alphabetical order is picked up (instead of the default_server). Why?

4
  • You have default_sever only on port 443. Do you use https? Commented Jan 29, 2015 at 12:30
  • on that site (the one with default_server set) yes. but not on all of my sites. Commented Jan 29, 2015 at 12:31
  • Well then, what are all other listen directive? Commented Jan 29, 2015 at 12:39
  • In vhosts that use https I have listen 80; listen 443 ssl spdy;, if they use only http I have just listen 80; Commented Jan 29, 2015 at 12:41

1 Answer 1

3

The default_server needs to be set for every port you use in your configuration. So, you need to add default_server after listen 80; to the virtual host you want to be the default server for port 80.

1
  • Yep! Worked.. :) Commented Jan 29, 2015 at 12:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.