[GH-ISSUE #108] Creating proxy for nginx-proxy-manager admin interface #96

Closed
opened 2026-02-26 05:34:28 +03:00 by kerem · 6 comments
Owner

Originally created by @cboulanger on GitHub (Mar 25, 2019).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/108

Hi,
Awesome piece of software, very useful, thank you very much for publishing it.

I am trying to create a proxy for the admin interface on port 91 81. Here is what I have:
Domain name: proxy.mydomain.de (real domain name here)
scheme: https
Forward host/port: 127.0.0.1:81
SSL certificate: proxy.mydomain.de
Force SSL

It shows status "Online", but when I access proxy.mydomain.de, I get a 502 Bad Gateway.

What am I doing wrong?

Originally created by @cboulanger on GitHub (Mar 25, 2019). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/108 Hi, Awesome piece of software, very useful, thank you very much for publishing it. I am trying to create a proxy for the admin interface on port ~91~ 81. Here is what I have: Domain name: proxy.mydomain.de (real domain name here) scheme: https Forward host/port: 127.0.0.1:81 SSL certificate: proxy.mydomain.de Force SSL It shows status "Online", but when I access proxy.mydomain.de, I get a 502 Bad Gateway. What am I doing wrong?
kerem closed this issue 2026-02-26 05:34:28 +03:00
Author
Owner

@kolbii commented on GitHub (Mar 25, 2019):

Can you make sure the service on port 81 is running?

<!-- gh-comment-id:476169358 --> @kolbii commented on GitHub (Mar 25, 2019): Can you make sure the service on port 81 is running?
Author
Owner

@cboulanger commented on GitHub (Mar 25, 2019):

Yes, it is, I am trying to use it to proxy itself...

<!-- gh-comment-id:476196165 --> @cboulanger commented on GitHub (Mar 25, 2019): Yes, it is, I am trying to use it to proxy itself...
Author
Owner

@cboulanger commented on GitHub (Mar 25, 2019):

My bad. nginx-proxy-manager serves http traffic only. when I switched to http, it worked. Closing.

<!-- gh-comment-id:476332711 --> @cboulanger commented on GitHub (Mar 25, 2019): My bad. nginx-proxy-manager serves http traffic only. when I switched to http, it worked. Closing.
Author
Owner

@RosaEinhorn commented on GitHub (Mar 27, 2020):

Can we put the admin interface behind a path? Like: domain.com/npm ? I'm trying it but it won't work. Can't find any info about it.

<!-- gh-comment-id:605046158 --> @RosaEinhorn commented on GitHub (Mar 27, 2020): Can we put the admin interface behind a path? Like: domain.com/npm ? I'm trying it but it won't work. Can't find any info about it.
Author
Owner

@miguelwill commented on GitHub (Mar 29, 2020):

nope, npm run only un root of URL host

<!-- gh-comment-id:605545365 --> @miguelwill commented on GitHub (Mar 29, 2020): nope, npm run only un root of URL host
Author
Owner

@GAS85 commented on GitHub (Jan 2, 2023):

nope, npm run only un root of URL host

This kind of an old issue, but actually it is possible to hide admin panel behind the sub path: https://wiki.sitnikov.eu/doku.php?id=howto:npm#final_npm_configuration
Add 2 locations:
изображение

From now there are 2 Options. Even if you combine them, you will not harm anything in NPM:

Option 1

And add Advanced rule:

location ~ ^/(css|js|images|login|assets|nginx|users|audit-log|settings) {
  return 307 https://$http_host/npm$request_uri?$args;
}

Replace npm with whatever you need in Custom Location and Advanced config.
Now you can control TLS configuration for NPM Admin Panel as for #481, #182

Option 2

UPDATE: Option 2 solutions only, you DO NOT NEED TO ADD API endpoint as above in a screenshot.

In "Custom Location" click on "Options" for /npm/ and add there rewrite content rules, so at the end it looks similar to:

    ### Paste here Rewrite content
    proxy_set_header Accept-Encoding "";
    sub_filter_once off;
    sub_filter_types text/html application/javascript text/css;
    sub_filter '/css' '/npm/css';
    sub_filter '/js/' '/npm/js/';
    sub_filter '"js/"' '"npm/js/"';
    sub_filter '/images' '/npm/images';
    sub_filter '/assets' '/npm/assets';
    sub_filter '/api' '/npm/api';
    sub_filter '/login' '/npm/login';

Also this will be Apache2 Configuration:

Redirect 301 "/npm" "/npm/"
	<Location /npm>
		ProxyPreserveHost On
		ProxyPass http://localhost:81/ retry=0 connectiontimeout=5 timeout=30 keepalive=on
		ProxyPassReverse http://localhost:81/
		RequestHeader set Connection ""
		AddOutputFilterByType INFLATE;SUBSTITUTE text/html application/javascript text/css
		Substitute "s|/css/|/npm/css/|inq"
		Substitute "s|/js/|/npm/js/|inq"
		Substitute "s|\"js/\"|\"npm/js/\"|inq"
		Substitute "s|/images|/npm/images|inq"
		Substitute "s|/assets|/npm/assets|inq"
		Substitute "s|/api|/npm/api|inq"
		Substitute "s|/login|/npm/login|inq"
	</Location>
<!-- gh-comment-id:1368837236 --> @GAS85 commented on GitHub (Jan 2, 2023): > nope, npm run only un root of URL host This kind of an old issue, but actually it is possible to hide admin panel behind the sub path: https://wiki.sitnikov.eu/doku.php?id=howto:npm#final_npm_configuration Add 2 locations: ![изображение](https://user-images.githubusercontent.com/6813635/210221280-8c497607-fd80-4d0b-9cbf-eada5bbb39ff.png) From now there are 2 Options. Even if you combine them, you will not harm anything in NPM: ### Option 1 And add Advanced rule: ```nginx location ~ ^/(css|js|images|login|assets|nginx|users|audit-log|settings) { return 307 https://$http_host/npm$request_uri?$args; } ``` Replace `npm` with whatever you need in Custom Location **and** Advanced config. Now you can control TLS configuration for NPM Admin Panel as for #481, #182 ### Option 2 UPDATE: Option 2 solutions only, you DO NOT NEED TO ADD API endpoint as above in a screenshot. In "Custom Location" click on "Options" for `/npm/` and add there rewrite content rules, so at the end it looks similar to: ```nginx ### Paste here Rewrite content proxy_set_header Accept-Encoding ""; sub_filter_once off; sub_filter_types text/html application/javascript text/css; sub_filter '/css' '/npm/css'; sub_filter '/js/' '/npm/js/'; sub_filter '"js/"' '"npm/js/"'; sub_filter '/images' '/npm/images'; sub_filter '/assets' '/npm/assets'; sub_filter '/api' '/npm/api'; sub_filter '/login' '/npm/login'; ``` Also this will be Apache2 Configuration: ``` Redirect 301 "/npm" "/npm/" <Location /npm> ProxyPreserveHost On ProxyPass http://localhost:81/ retry=0 connectiontimeout=5 timeout=30 keepalive=on ProxyPassReverse http://localhost:81/ RequestHeader set Connection "" AddOutputFilterByType INFLATE;SUBSTITUTE text/html application/javascript text/css Substitute "s|/css/|/npm/css/|inq" Substitute "s|/js/|/npm/js/|inq" Substitute "s|\"js/\"|\"npm/js/\"|inq" Substitute "s|/images|/npm/images|inq" Substitute "s|/assets|/npm/assets|inq" Substitute "s|/api|/npm/api|inq" Substitute "s|/login|/npm/login|inq" </Location> ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#96
No description provided.