A seemingly very simple reverse proxy config is giving me headache here.
Main config file /etc/nginx/nginx.conf has
"include /etc/nginx/conf.d/*.conf;"
Then I have two conf files under conf.d:
default-1.conf
and default-2.conf
First file has:
server {
# HealthCheck
server_name _;
listen 0.0.0.0:443 ssl ;
location = /health.html {
root /usr/share/nginx/html;
}
}
And second file has additional proxy statements as
server {
listen 0.0.0.0:443 ssl ;
server_name www.example2.com;
...
location / {
set $backend "some-backend";
proxy_pass $scheme://$backend;
}
}
When there is only default-1.conf is under conf.d/,
curl -k https://localhost/health.html
works.
If I also put default-2.conf under conf.d/, then same curl command gives 404 Not Found. I don't see any error under error.log either. What am I doing wrong?
How can I learn the rules applied during building final conf file using these multiple smaller conf files?
Thank you.