Skip to content

Feat: allow user set custom ports for Nginx and Web UI#5212

Open
beniamin wants to merge 1 commit intoNginxProxyManager:developfrom
beniamin:custom-ports
Open

Feat: allow user set custom ports for Nginx and Web UI#5212
beniamin wants to merge 1 commit intoNginxProxyManager:developfrom
beniamin:custom-ports

Conversation

@beniamin
Copy link

@beniamin beniamin commented Jan 23, 2026

Latest versions of TrueNAS have been migrated the Apps from k8s to docker and nginx-proxy-manager is the recommended way(in multiple discussion) to be used as a proxy for internal applications. For the setup to be secure and Nginx-proxy-manager to properly forward the traffic to the internal apps, it must be deployed using host_network options.

There are several issues on TrueNAS Apps Catalog repo([Enhancement]: Nginx Proxy Manager - host network and Allow Host Networking for Nginx Proxy Manager) asking for possibility to set nginx-proxy-manager with host_network, but since 80,443 and 81 ports may conflict with other running services on the server, TrueNAS admin require that nginx-proxy-manager should have the possibility to to use custom ports instead of default ones.

This PR change current behavior and adds option for default ports to be changed trough HTTP_PORT, HTTPS_PORT and WEB_UI_PORT environment variables.

@beniamin beniamin marked this pull request as draft January 23, 2026 22:39
…host network where some other services may already use 80,443,81 ports
@beniamin beniamin changed the title custom ports allow user set custom ports for Nginx and Web UI Jan 27, 2026
@nginxproxymanagerci
Copy link

Docker Image for build 4 is available on DockerHub:

nginxproxymanager/nginx-proxy-manager-dev:pr-5212

Note

Ensure you backup your NPM instance before testing this image! Especially if there are database changes.
This is a different docker image namespace than the official image.

Warning

Changes and additions to DNS Providers require verification by at least 2 members of the community!

@beniamin beniamin marked this pull request as ready for review January 27, 2026 12:09
@beniamin beniamin changed the title allow user set custom ports for Nginx and Web UI Feat: allow user set custom ports for Nginx and Web UI Jan 27, 2026
do
echo "- ${FILE}"
# Replace HTTP port
sed -i -E "s/listen 80([^0-9]|$)/listen ${HTTP_PORT}\1/g" "$FILE"
Copy link
Member

@jc21 jc21 Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you're trying to do here and I'm glad you thought of this. Something I would consider though..

This script runs on each startup, yet it seems like a run-once migration. Some options that might be better:

  1. create a migration, they're not just for databases. In this case it could iterate over all hosts and regenerate their nginx config, however there are risks doing this too
  2. Or keep this file but don't be specific with 80/443. Consider what should happen if I change to 8080/8443 and then change to 8888/9999. I'd expect this script to handle it

Option 2 is probably my preference here.

@jc21 jc21 added enhancement requires-verification Waiting for one or more people to confirm the fix labels Feb 18, 2026
@jc21
Copy link
Member

jc21 commented Feb 18, 2026

Thanks for the work on this! It's been on my mind to do this for a while...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement requires-verification Waiting for one or more people to confirm the fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments