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

Nginx default_server catches all. Why?

$
0
0
Hello all,

I have got 2 different URLs that are correctly redirected by Proxy_Pass.
However as soon as I add the default_server (first server below), my 2 URLs are not redirected anymore. They fall into the catch all.
Why is that? I don't understand what is wrong in the default configuration.
Thanks for your help!


# default server for this IP
server{
listen xx.xx.xx.xx:8443 default_server;
server_name _;
return 404;
}

server{
listen xx.xx.xx.xx:8443;
server_name *.staging1.xxxx.com staging1.xxxx.com;

ssl on;
ssl_certificate /etc/letsencrypt/live/mindbelts.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mindbelts.com/privkey.pem;

location / {
proxy_pass http://127.0.0.1:6981;
proxy_set_header Host $host;
}
}


server{
listen xx.xx.xx.xx:8443;
server_name *.staging2.yyyy.com .staging2.yyyy.com

ssl on;
ssl_certificate /etc/letsencrypt/live/mindbelts.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mindbelts.com/privkey.pem;

location / {
proxy_pass http://127.0.0.1:6982;
proxy_set_header Host $host;
}
}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



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