[GH-ISSUE #252] Listening Custom Ports #222

Closed
opened 2026-02-26 06:31:35 +03:00 by kerem · 14 comments
Owner

Originally created by @hashimea on GitHub (Dec 6, 2019).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/252

Is your feature request related to a problem? Please describe.
I would like to make the proxy listen to another custom port.
so that domain.com:8006 can be forwarded.

Describe the solution you'd like
Add Custom port support

If this can be done through custom configuration please let me know

Originally created by @hashimea on GitHub (Dec 6, 2019). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/252 **Is your feature request related to a problem? Please describe.** I would like to make the proxy listen to another custom port. so that domain.com:8006 can be forwarded. **Describe the solution you'd like** Add Custom port support If this can be done through custom configuration please let me know
kerem 2026-02-26 06:31:35 +03:00
Author
Owner

@Cerothen commented on GitHub (Jan 5, 2020):

I do this by just adding listen 8448 ssl http2; to the custom configuration area. This example is for a synapse matrix server on their federation port.

<!-- gh-comment-id:570930141 --> @Cerothen commented on GitHub (Jan 5, 2020): I do this by just adding ``` listen 8448 ssl http2; ``` to the custom configuration area. This example is for a synapse matrix server on their federation port.
Author
Owner

@Xinil commented on GitHub (Jan 11, 2020):

I do this by just adding listen 8448 ssl http2; to the custom configuration area. This example is for a synapse matrix server on their federation port.

Chiming in, thanks for the details @Cerothen! Any ideas how to accomplish this on a web socket port? For example, it's trying to open port 7446 over a wss:// stream, but seems that listen config doesn't quite work for that purpose though?

<!-- gh-comment-id:573278000 --> @Xinil commented on GitHub (Jan 11, 2020): > I do this by just adding `listen 8448 ssl http2;` to the custom configuration area. This example is for a synapse matrix server on their federation port. Chiming in, thanks for the details @Cerothen! Any ideas how to accomplish this on a web socket port? For example, it's trying to open port 7446 over a wss:// stream, but seems that `listen` config doesn't quite work for that purpose though?
Author
Owner

@Cerothen commented on GitHub (Jan 11, 2020):

Below is what I am using for my FreePBX proxy, this just goes right into the "advanced" tab. If you put in a ```location /```` then it seems to replace the default block that would have been put in.

listen 8003 ssl http2;
listen 8089 ssl http2;

location / {
    # Force SSL
    include conf.d/include/force-ssl.conf;
    # HSTS (ngx_http_headers_module is required) (31536000 seconds = 1 year)
    add_header Strict-Transport-Security "max-age=31536000;includeSubDomains; preload" always;
    # Websocket
	proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
	# Resolve Issues
	proxy_buffer_size 64k;
	proxy_buffers 4 128k;
	proxy_busy_buffers_size 128k;
    # Proxy!
	if ($server_port = 8003) {
        proxy_pass       https://192.168.10.100:8003;
    }
    if ($server_port = 8089) {
        proxy_pass       https://192.168.10.100:8089;
    }
    include conf.d/include/proxy.conf;
}

ports 8003 and 8089 are both websocket ports

<!-- gh-comment-id:573284021 --> @Cerothen commented on GitHub (Jan 11, 2020): Below is what I am using for my FreePBX proxy, this just goes right into the "advanced" tab. If you put in a ```location /```` then it seems to replace the default block that would have been put in. ``` listen 8003 ssl http2; listen 8089 ssl http2; location / { # Force SSL include conf.d/include/force-ssl.conf; # HSTS (ngx_http_headers_module is required) (31536000 seconds = 1 year) add_header Strict-Transport-Security "max-age=31536000;includeSubDomains; preload" always; # Websocket proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_http_version 1.1; # Resolve Issues proxy_buffer_size 64k; proxy_buffers 4 128k; proxy_busy_buffers_size 128k; # Proxy! if ($server_port = 8003) { proxy_pass https://192.168.10.100:8003; } if ($server_port = 8089) { proxy_pass https://192.168.10.100:8089; } include conf.d/include/proxy.conf; } ``` ports 8003 and 8089 are both websocket ports
Author
Owner

@Xinil commented on GitHub (Jan 11, 2020):

Thanks for the help! I tried your suggestion, and while the proxy host still works, the 7446 connection still doesn't seem to work. Basically when I try to load the camera accessing that web socket, I get the console error: WebSocket connection to 'wss://unifivideo.mydomain.com:7446/AzwJjYP_FCECDA1F2F06_1?progressive' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Below is your config, modified for my env:

listen 7443 ssl http2;
listen 7446 ssl http2;

location / {
    # Force SSL
    include conf.d/include/force-ssl.conf;
    # HSTS (ngx_http_headers_module is required) (31536000 seconds = 1 year)
    add_header Strict-Transport-Security "max-age=31536000;includeSubDomains; preload" always;
    # Websocket
	proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
	# Resolve Issues
	proxy_buffer_size 64k;
	proxy_buffers 4 128k;
	proxy_busy_buffers_size 128k;
    # Proxy!
	if ($server_port = 7443) {
        proxy_pass       https://192.168.10.52:7443;
    }
    if ($server_port = 7446) {
        proxy_pass       https://192.168.10.52:7446;
    }
    include conf.d/include/proxy.conf;
}
<!-- gh-comment-id:573289838 --> @Xinil commented on GitHub (Jan 11, 2020): Thanks for the help! I tried your suggestion, and while the proxy host still works, the 7446 connection still doesn't seem to work. Basically when I try to load the camera accessing that web socket, I get the console error: ```WebSocket connection to 'wss://unifivideo.mydomain.com:7446/AzwJjYP_FCECDA1F2F06_1?progressive' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED``` Below is your config, modified for my env: ``` listen 7443 ssl http2; listen 7446 ssl http2; location / { # Force SSL include conf.d/include/force-ssl.conf; # HSTS (ngx_http_headers_module is required) (31536000 seconds = 1 year) add_header Strict-Transport-Security "max-age=31536000;includeSubDomains; preload" always; # Websocket proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_http_version 1.1; # Resolve Issues proxy_buffer_size 64k; proxy_buffers 4 128k; proxy_busy_buffers_size 128k; # Proxy! if ($server_port = 7443) { proxy_pass https://192.168.10.52:7443; } if ($server_port = 7446) { proxy_pass https://192.168.10.52:7446; } include conf.d/include/proxy.conf; } ```
Author
Owner

@Cerothen commented on GitHub (Jan 11, 2020):

This might seem like a silly question but have you confirmed all the other relevant points where the connection could be refused?

Eg.

  • Is the router port forwarded properly.
  • When you setup the Docker container did you set the container to use the host network or did you set it to also put though the port your looking for (in addition to the standard 80, 81, 443).
  • I'm on 2.0.14 for mine if your different perhaps there are some different build options?

Those are my only other suggestions. Hopefully they help you

<!-- gh-comment-id:573317932 --> @Cerothen commented on GitHub (Jan 11, 2020): This might seem like a silly question but have you confirmed all the other relevant points where the connection could be refused? Eg. - Is the router port forwarded properly. - When you setup the Docker container did you set the container to use the host network or did you set it to also put though the port your looking for (in addition to the standard 80, 81, 443). - I'm on 2.0.14 for mine if your different perhaps there are some different build options? Those are my only other suggestions. Hopefully they help you
Author
Owner

@LukasSt46 commented on GitHub (Aug 18, 2020):

Thx @Cerothen for all with the same Problem look at your Docker Config, i forgot to route ports 7443 and 7446 to the container: My Working Config for a unifivideo Controller(I only added this code under Advanced):

`listen 7443 ssl http2;
listen 7446 ssl http2;

location / {
# Force SSL
include conf.d/include/force-ssl.conf;
# HSTS (ngx_http_headers_module is required) (31536000 seconds = 1 year)
add_header Strict-Transport-Security "max-age=31536000;includeSubDomains; preload" always;
# Websocket
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
# Resolve Issues
proxy_buffer_size 64k;
proxy_buffers 4 128k;
proxy_busy_buffers_size 128k;
# Proxy!
if ($server_port = 7443) {
proxy_pass http://10.0.40.1:7080;
}
if ($server_port = 7446) {
proxy_pass http://10.0.40.1:7445;
}
include conf.d/include/proxy.conf;
}`

Sorry for my bad english :-)

<!-- gh-comment-id:675600191 --> @LukasSt46 commented on GitHub (Aug 18, 2020): Thx @Cerothen for all with the same Problem look at your Docker Config, i forgot to route ports 7443 and 7446 to the container: My Working Config for a unifivideo Controller(I only added this code under Advanced): `listen 7443 ssl http2; listen 7446 ssl http2; location / { # Force SSL include conf.d/include/force-ssl.conf; # HSTS (ngx_http_headers_module is required) (31536000 seconds = 1 year) add_header Strict-Transport-Security "max-age=31536000;includeSubDomains; preload" always; # Websocket proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_http_version 1.1; # Resolve Issues proxy_buffer_size 64k; proxy_buffers 4 128k; proxy_busy_buffers_size 128k; # Proxy! if ($server_port = 7443) { proxy_pass http://10.0.40.1:7080; } if ($server_port = 7446) { proxy_pass http://10.0.40.1:7445; } include conf.d/include/proxy.conf; }` Sorry for my bad english :-)
Author
Owner

@RideMyByte commented on GitHub (Feb 16, 2021):

I do this by just adding listen 8448 ssl http2; to the custom configuration area. This example is for a synapse matrix server on their federation port.

Hi! I'm currently setting up synapse with the proxy manager. does not work.
can you send me screenshots of your nginx proxy manager configuration?

Thx a lot :-)

<!-- gh-comment-id:779784582 --> @RideMyByte commented on GitHub (Feb 16, 2021): > I do this by just adding `listen 8448 ssl http2;` to the custom configuration area. This example is for a synapse matrix server on their federation port. Hi! I'm currently setting up synapse with the proxy manager. does not work. can you send me screenshots of your nginx proxy manager configuration? Thx a lot :-)
Author
Owner

@Cerothen commented on GitHub (Feb 22, 2021):

Everything is standard with this in the "Advanced". You have to create the proxy host and have it issue the certificate then add the advanced part in to satisfy the listen parameters

add_header Access-Control-Allow-Origin *;
listen 8448 ssl http2;
access_log  off;
error_log off;
<!-- gh-comment-id:783091034 --> @Cerothen commented on GitHub (Feb 22, 2021): Everything is standard with this in the "Advanced". You have to create the proxy host and have it issue the certificate then add the advanced part in to satisfy the listen parameters ``` add_header Access-Control-Allow-Origin *; listen 8448 ssl http2; access_log off; error_log off; ```
Author
Owner

@thytetgc commented on GitHub (Mar 19, 2021):

Everything is standard with this in the "Advanced". You have to create the proxy host and have it issue the certificate then add the advanced part in to satisfy the listen parameters

add_header Access-Control-Allow-Origin *;
listen 8448 ssl http2;
access_log  off;
error_log off;

adding ssl http2 makes the page not work!

<!-- gh-comment-id:802527314 --> @thytetgc commented on GitHub (Mar 19, 2021): > Everything is standard with this in the "Advanced". You have to create the proxy host and have it issue the certificate then add the advanced part in to satisfy the listen parameters > > ``` > add_header Access-Control-Allow-Origin *; > listen 8448 ssl http2; > access_log off; > error_log off; > ``` adding **ssl http2** makes the page not work!
Author
Owner

@thebiblelover7 commented on GitHub (Sep 8, 2021):

I do this by just adding listen 8448 ssl http2; to the custom configuration area. This example is for a synapse matrix server on their federation port.

You saved me from giving up trying to setup matrix federation! Thanks so much!

@chaptergy Shouldn't this be closed now?

<!-- gh-comment-id:915270444 --> @thebiblelover7 commented on GitHub (Sep 8, 2021): > I do this by just adding `listen 8448 ssl http2;` to the custom configuration area. This example is for a synapse matrix server on their federation port. You saved me from giving up trying to setup matrix federation! Thanks so much! @chaptergy Shouldn't this be closed now?
Author
Owner

@chaptergy commented on GitHub (Sep 8, 2021):

@chaptergy Shouldn't this be closed now?

Sure, I can go ahead and close it.

<!-- gh-comment-id:915288516 --> @chaptergy commented on GitHub (Sep 8, 2021): > @chaptergy Shouldn't this be closed now? Sure, I can go ahead and close it.
Author
Owner

@andzejsp commented on GitHub (Jul 28, 2022):

I dont know about you guys but im having troubles with the synapse federation. The proxy manager shows my domain is online, but the https://federationtester.matrix.org says connection errors.
So far in nginx proxy manager i set up:
My domain name
Scheme: http
Forward port: 8008
Cache assets: true
Block common exploits: true
Web sockets support: true
Got ssl certi
Force ssl: true
Hsts enabled: true
in the "Advanced" tab:

add_header Access-Control-Allow-Origin *;
listen 8448 ssl http2;
access_log  off;
error_log off;

But i cant get the federation to work. I can access the matrix server locally and from outside networks but cant seem to access other matrix servers rooms.

any little help would be appreciated
EDIT:

Been looking for solution for days, posted this here and few hours laters found solution.
For all the others that might get stuck with this problem in the future.

in the "Advanced" tab: add this

add_header Access-Control-Allow-Origin *;
listen 8448 ssl http2;

location /.well-known/matrix/server {
    return 200 '{"m.server": "my.server.com:443"}'; # < --- replace my.server.com with your matrix domain and youre good to go
    default_type application/json;
    add_header Access-Control-Allow-Origin *;
}
<!-- gh-comment-id:1197688889 --> @andzejsp commented on GitHub (Jul 28, 2022): I dont know about you guys but im having troubles with the synapse federation. The proxy manager shows my domain is online, but the https://federationtester.matrix.org says connection errors. So far in nginx proxy manager i set up: My domain name Scheme: http Forward port: 8008 Cache assets: true Block common exploits: true Web sockets support: true Got ssl certi Force ssl: true Hsts enabled: true in the "Advanced" tab: ``` add_header Access-Control-Allow-Origin *; listen 8448 ssl http2; access_log off; error_log off; ``` But i cant get the federation to work. I can access the matrix server locally and from outside networks but cant seem to access other matrix servers rooms. any little help would be appreciated EDIT: Been looking for solution for days, posted this here and few hours laters found solution. For all the others that might get stuck with this problem in the future. in the "Advanced" tab: add this ``` add_header Access-Control-Allow-Origin *; listen 8448 ssl http2; location /.well-known/matrix/server { return 200 '{"m.server": "my.server.com:443"}'; # < --- replace my.server.com with your matrix domain and youre good to go default_type application/json; add_header Access-Control-Allow-Origin *; } ```
Author
Owner

@Cerothen commented on GitHub (Jul 28, 2022):

I feel like in this case reviewing your homeserver.yaml in synapse might be the issue. Confirm that you enabled the appropriate federation end points for port 8008. I think be default they are only on for 8448

<!-- gh-comment-id:1198557514 --> @Cerothen commented on GitHub (Jul 28, 2022): I feel like in this case reviewing your homeserver.yaml in synapse might be the issue. Confirm that you enabled the appropriate federation end points for port 8008. I think be default they are only on for 8448
Author
Owner

@grumpazoid commented on GitHub (Oct 17, 2022):

@Cerothen Just wanted to give thanks for your config. It was the answer to my problem of needing to be able to listen on two different SSL ports. I could not find any complete documentation for the advanced tab anywhere.

<!-- gh-comment-id:1280586890 --> @grumpazoid commented on GitHub (Oct 17, 2022): @Cerothen Just wanted to give thanks for your config. It was the answer to my problem of needing to be able to listen on two different SSL ports. I could not find any complete documentation for the advanced tab anywhere.
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#222
No description provided.