I am wanting to use multiple files declared at
/etc/nging/sites-available/
symlinked to:
/etc/nginx/sites-enabled/
Now the files look similar to below - call this team1.conf:
server {
listen 80;
location /team1/app3/location/region {
rewrite ^/team1/app3/location/region(.*) /path3/healthcheck$1 break;
proxy_pass https://this.is.the.backend.app.example;
}
location /team1/app4/location/region {
rewrite ^/team1/app4/location/region(.*) /path4/healthcheck$1 break;
proxy_pass https://this.is.the.backend.app.example;
}
location /team1/app5/location/region {
rewrite ^/team1/app5/location/region(.*) /path5/healthcheck$1 break;
proxy_pass https://this.is.the.backend.app.example;
}
}
Call this team2.conf:
server {
listen 80;
location /team2/app3/location/region {
rewrite ^/team2/app3/location/region(.*) /path3/healthcheck$1 break;
proxy_pass https://this.is.the.backend.app.example;
}
location /team2/app4/location/region {
rewrite ^/team2/app4/location/region(.*) /path4/healthcheck$1 break;
proxy_pass https://this.is.the.backend.app.example;
}
location /team2/app5/location/region {
rewrite ^/team2/app5/location/region(.*) /path5/healthcheck$1 break;
proxy_pass https://this.is.the.backend.app.example;
}
}
I wanted to keep them separate - hence the separate files - however, with two files, nginx just seems to read the first one and 404 anything in the second one - so I suspect there is a conflict somewhere....
The files are pretty arbitrary - I just wanted to demonstrate - the paths etc, will vary between files..
Any help would be great - apologies if I've missed something obvious..
Cheers
server_namedirective isn't specified for both, the first one will act as the default server processing any request and the second one will never be used at all.includedirective, but don't place those files inside thesites-enableddirectory - everything being placed in that directory is included under thehttpcontext, not theserverone./etc/nginx/conf.d/? What about the clashing of ports comment and theserver_name- I think I've tried serving them from this directory and had the same issue - but perhaps that was theserver_nameissue again...