Score:1

nginx Proxy Manager Custom Locations

um flag

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.

IIS proxied by nginx

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.

apache root doc apache more doc

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.

nginx proxy host definition custom location

This appears to work.

Browser loads apache root

...until you try to load some other resource from Apache but get the same content.

Trying to load something other than the root document

It appears that absolutely anything beginning with apache/ is mapped to the root document.

anycrap

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;
}
djdomi avatar
za flag
hi, any admin panels would be off-topic. However, I would use Nginx as the first contact and then let Nginx decide based on the config, where it should go to.
um flag
I can see the config file, it's in a mapped volume on dockerhost but I don't seem to have edit permission.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.