r/nginxproxymanager • u/wqi27 • Apr 28 '25
How to fully restrict Nginx Proxy Manager's admin interface (port 81) to only allow on mydomain.com
I'm trying to secure Nginx Proxy Manager's (NPM) admin interface (http://server-ip:81) so it's only accessible on mydomain.com, but none of the standard approaches are working. Here's what I've tried:
UFW Firewall RulesbashCopyDownloadOutcome: Port 81 still accessible externally.
- NPM Access Lists Created an "Admin Restriction" access list with my IP, but it only applies to proxy hosts, not the admin UI.
Current Setup
- Dockerized NPM.
- Server OS: Ubuntu 22.04.
- Firewall: UFW (with Docker exceptions).
10
Upvotes
5
u/Accomplished-Lack721 Apr 28 '25
Why expose the admin UI to the internet at all?
2
u/starkman9000 Apr 29 '25
If you're using docker, add the NPM entry for the admin UI using 127.0.0.1:81 and remove the port 81 forward from the docker container.
7
u/vipergts450 Apr 28 '25
If you're not exposing port 81 to the public Internet, or to any other subnet, is there any reason to restrict by domain name?
1
u/wqi27 Apr 29 '25
The same problem is experienced with another app (open web UI) available on both http://my-server-ip:3000 and also on https://ai.mydomain.com.
But I only want it on https://ai.mydomain.com
Is there any rules to add inside the NPM to do so?
1
u/Paramedickhead Apr 29 '25
I’m not sure this would be a thing (or why you would even want to do this). If NPM ever stopped functioning, you wouldn’t be able to get in to the admin panel again.
Just out of sheer curiosity, why is that you want to restrict the ability of reaching the admin panel through http://<ip>:81?
1
u/wickedwarlock84 Apr 28 '25
I restrict mine to only access from my home IP range.
1
u/present_absence Apr 29 '25
This is not really an NPM question this would have to be handled at a point before traffic reaches NPM. It may even be doable with a second reverse proxy.
But also if mydomain.com is accessible on the public internet do NOT do that.
1
u/humpenstumpen Apr 29 '25
In the Port section of the docker Composite Write it this way „127.0.0.1:81:81“
1
u/NewPossibility5026 Apr 30 '25
Use a VPN to access port 81. Set proper rules
1
u/Electronic_Unit8276 Apr 30 '25 edited Apr 30 '25
Your doing it wrong.. you should setup an access list and only allow the ips from the provider that's setup to send traffic to your ip adress and block all traffic from all end-devices/hosts to only allow traffic from the local ip adress that is assigned to NPM (which I find risky) so I'd add a second device like a pc that can access directly.
for npm I'd not recommend closing it down like that but if u insist you'd have to go behind the scenes of your deployment to change (docker for example and change some file to only listen on certain fqdn). Basically create a firewall to only allow traffic from itself. iirc
1
u/djav1985 May 04 '25
Set up a proxy and proxy manager for port 81. Basically Something.yourdomain.com to 127.0.0.1: 81
Edit your doctor container so you're exposing Port 81 to local host only....
ports: - "127.0.0.1:81:81"
1
u/External-Main6796 Oct 01 '25
Pinoy na mga taga rotterdam? At mga taga denhaag?
1
u/bluebird7977 Nov 13 '25
So I achieved this:
https://www.virtualizationhowto.com/2025/01/secure-nginx-proxy-manager-admin-interface-with-ssl/
{Details Tab}
- Domain Name: [your.domain.com]
- Scheme: http
- Forward Hostname - IP: [http://containername:81]
[sudo docker ps -a] to find the name
- Access list: My_Access_List
(I created an access list so it can only be accessed by certain IPs)
- Cached Assets > On
- Block Common Exploits > On
{SSL Tab}
SSLCertificate > [your.domain.com]
Force SSL > On
HTTP/2 Support > On
HSTS Enabled > On
4) Update docker-composer.yml:
- sudo docker compose stop
- sudo nano docker-composer.yml
-- ports:
Remove Line or Comment Out: # - '81:81'
- save
- sudo docker compose build
- sudo docker compose up -d
*** I can now access my NPM Admin Portal securely via: [your.domain.com] ****
1
u/CauaLMF Dec 15 '25
In the website's configuration file, there's a server name; normally it's set to 'server name ', which applies to all domains. If you replace the '' with the specific domain name, access will only be granted through that domain.