title: Configure NGINX proxy to Gunicorn socket and Tomcat
body: <p>I'm trying to set up NGINX to redirect incoming traffic either to Gunicorn (for the main django app) or to tomcat.</p>
  <p>The django app is working at http://localhost with this configuration. But I'm having trouble getting tomcat (on port 8080) to be accessible at http://localhost/admin-tomcat. Geoserver is a webbapp of tomcat and I'd like to access it at http://localhost/admin-geoserver.</p>
  <pre><code>server {
      listen 80;
      server_name localhost;
      server_name_in_redirect off;
      proxy_set_header Host $host:$server_port;
  
      location = /favicon.ico { access_log off; log_not_found off; }
      location /static/ {
          root /path/to/django/project;
      }
  
      location / {
          include proxy_params;
          proxy_pass http://unix:/run/gunicorn.sock;
      }
  
      location /admin-tomcat/ {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_pass http://localhost:8080;
      }
  
      location /admin-geoserver/ {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_pass http://localhost:8080/geoserver;
      }
  }
  
  </code></pre>
  <p>It seems that NGINX is forwarding http://localhost/admin-tomcat to Django who doesn't find tomcat (which is normal). What is wrong with my configuration ?</p>