Skip to content

Instantly share code, notes, and snippets.

@ArnyminerZ
Last active May 17, 2022 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArnyminerZ/d3151fc15f564f87ce09031a6e410a3e to your computer and use it in GitHub Desktop.
Save ArnyminerZ/d3151fc15f564f87ce09031a6e410a3e to your computer and use it in GitHub Desktop.
A gist that expands Nginx Proxy Manager to redirect a custom subdomain to a QuMagie instance, without giving public access to QTS. File in markdown for syntax highlighting.

qumagie.conf:

# ------------------------------------------------------------
# qumagie.mydomain.com
# ------------------------------------------------------------


server {
  set $forward_scheme http;
  set $server         "192.168.1.20";
  set $port           9123;

  listen 80;
  listen [::]:80;


  server_name qumagie.mydomain.com;

  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $http_connection;
  proxy_http_version 1.1;


  access_log /data/logs/proxy-host-9_access.log proxy;
  error_log /data/logs/proxy-host-9_error.log warn;

  location / {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_http_version 1.1;

    # Additional variables
    set $redirect_uri "/apps/qumagie";

    # Proxy
    add_header       X-Served-By $host;
    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       $forward_scheme://$server:$port$redirect_uri$request_uri;
  }

  location /apps/qumagie {
    rewrite ^/apps/qumagie(.*)$ http://qumagie.mydomain.com$1 redirect;
  }

  location /cgi-bin/images {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_http_version 1.1;

    # Additional variables
    set $redirect_uri "/cgi-bin/images";

    # Proxy
    add_header       X-Served-By $host;
    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       $forward_scheme://$server:$port$redirect_uri$request_uri;
  }

  location /v3_menu {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_http_version 1.1;

    # Additional variables
    set $redirect_uri "/v3_menu";

    # Proxy
    add_header       X-Served-By $host;
    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       $forward_scheme://$server:$port$redirect_uri$request_uri;
  }


  # Custom
  include /data/nginx/custom/server_proxy[.]conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment