Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: Websites can get to the correct server blocks

$
0
0
Hi,

It should work as expected. Please check two things:

1) make sure you're connecting using HTTP/1.1 protocol and not HTTP/1.0 which does not support virtual hosts.

2) in your example on stackoverflow the "listen" directive was configured ambiguously -- you must not use colon after "listen":

listen 80; # not listen: 80

3) if the above doesn't work, create a default server block:

server {
listen 80 default_server;
server_name "_";
...
}

restart nginx and see if all your requests now go to the default server. If that is the case, it means that your virtual hosts do not capture requests and that the problem lies somewhere else. Maybe HTTP/1.1 "Host:" header line is filtered out before your virtual hosts are accessed?

Andrejs
loco (at) andrews.lv

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>