Ultimately I intend to configure nginx to proxy content from web services on different hosts. As currently set up I'm using nginx Proxy Manager with nginx in Docker containers. To exclude the complexities of web service setup from the issues of configuring the reverse proxy, I have set up web servers with static content.
- I have Apache in a container on the same docker network as the nginx container.
- I have IIS on my workstation.
As you can see from this grab I have nginx successfully set up to proxy my workstation's IIS (not to mention a public DNS entry for my external interface. That's working fine.
These grabs show that the Apache container maps 80 to 8080 on the docker host which is imaginatively named dockerhost, and the browser on my workstation can access both the root document and another document by name.
At this point I altered the nginx proxy host definition to define a custom location. Within the docker network Apache is on port 80; this is why I've specified 80 rather than 8080.
This appears to work.
...until you try to load some other resource from Apache but get the same content.
It appears that absolutely anything beginning with apache/
is mapped to the root document.
At this point I went back and looked for documentation but failed to find anything relevant.
Swapping things around so that nginx proxies IIS and the custom location iis
points at IIS on my workstation exhibits exactly the same problem, this time with IIS.
How should this configuration be expressed?
A Proxy Manager based answer is preferable, I have quite a bit to learn before I can use instructions on hacking the nginx config directly.
That said, for diagnostic use, here's the generated config.
# ---------------------------------------------
# wone.pdconsec.net
# ---------------------------------------------
server {
set $forward_scheme http;
set $server "pnuc.lan";
set $port 80;
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name wone.pdconsec.net;
# Let's Encrypt SSL
include conf.d/include/letsencrypt-acme-challenge.conf;
include conf.d/include/ssl-ciphers.conf;
ssl_certificate /etc/letsencrypt/live/npm-1/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/npm-1/privkey.pem;
access_log /data/logs/proxy-host-1_access.log proxy;
error_log /data/logs/proxy-host-1_error.log warn;
location /apache {
set $upstream http://apache:80/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass $upstream;
}
location / {
# Proxy!
include conf.d/include/proxy.conf;
}
# Custom
include /data/nginx/custom/server_proxy[.]conf;
}