[GH-ISSUE #807] Specific Port #679

Closed
opened 2026-02-26 06:33:58 +03:00 by kerem · 5 comments
Owner

Originally created by @hyprem on GitHub (Jan 6, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/807

HI

I would like to redirect a specific Port to a Service. I tried to do this via the Streams function in the Proxy Manager but it seems not working.
Here is my Nginx configuration that worked:

server {
# The IP that you forwarded in your router (nginx proxy)
  listen 192.168.XX.XX:7615; # this is not the default_server

# Make site accessible from http://localhost/
 server_name isl.domain.com;

# The internal IP of the VM that host you Apache config
 set $upstream 192.168.XX.XX:7615;

 location / {
 proxy_pass http://$upstream;
 }
}

This was for Port 7615
And this config was for the main proxy Part:

map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

proxy_buffering off;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;

server {
    listen 192.168.XX.XX:80;
    server_name isl.domain.com;

    location / {
        proxy_pass http://192.168.XX.XX:7620;
    }
}

server {
    listen 192.168.XX.XX:443 ssl;
    server_name isl.domain.com www.isl.domain.com;
    ssl_certificate /etc/nginx/ssl/wildcart.cert;
    ssl_certificate_key /etc/nginx/ssl/key.key;

    location / {
        proxy_pass https://192.168.XX.XX:7621;
    }
}

Can anyone help me on achiving this in the Nginx Proxy Manager

Originally created by @hyprem on GitHub (Jan 6, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/807 HI I would like to redirect a specific Port to a Service. I tried to do this via the Streams function in the Proxy Manager but it seems not working. Here is my Nginx configuration that worked: ```nginx server { # The IP that you forwarded in your router (nginx proxy) listen 192.168.XX.XX:7615; # this is not the default_server # Make site accessible from http://localhost/ server_name isl.domain.com; # The internal IP of the VM that host you Apache config set $upstream 192.168.XX.XX:7615; location / { proxy_pass http://$upstream; } } ``` This was for Port 7615 And this config was for the main proxy Part: ```nginx map $http_upgrade $connection_upgrade { default upgrade; '' close; } proxy_buffering off; proxy_request_buffering off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; server { listen 192.168.XX.XX:80; server_name isl.domain.com; location / { proxy_pass http://192.168.XX.XX:7620; } } server { listen 192.168.XX.XX:443 ssl; server_name isl.domain.com www.isl.domain.com; ssl_certificate /etc/nginx/ssl/wildcart.cert; ssl_certificate_key /etc/nginx/ssl/key.key; location / { proxy_pass https://192.168.XX.XX:7621; } } ``` Can anyone help me on achiving this in the Nginx Proxy Manager
kerem 2026-02-26 06:33:58 +03:00
Author
Owner

@inmanturbo commented on GitHub (Jan 6, 2021):

Hello, may not be exactly what you are looking for but (I think) you can do this with the advanced tab for proxy hosts. If include your whole location slash (/) block and stuff in there you will essentially override everything. Here is an example of an advanced config that I paste into the advanced text box in order to check auth against a custom auth server on otherwise unprotected (static) site:

  location / {
          auth_request     /auth;
          auth_request_set $auth_status $upstream_status;
          proxy_pass          http://example.static:4242;

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

         # Proxy!
         #include conf.d/include/proxy.conf;
    }

    error_page 401 = @login;
    location @login {
        return 302 http://auth1.example.com/authenticate?return=$http_host;
    }

    location = /auth {
            internal;
            proxy_pass              http://auth2.example.com/auth-check;
            proxy_pass_request_body off;
            proxy_set_header        Content-Length "";
            proxy_set_header        X-Original-URI $request_uri;
     }

As you can see, almost none of these options are available in the GUI, yet nonetheless if you can do it with nginx, or Open Resty (basically nginx with a ton of extra features), you can do it in the advanced box.

So you can do one (advanced) host per server block with your config above.

<!-- gh-comment-id:755448304 --> @inmanturbo commented on GitHub (Jan 6, 2021): Hello, may not be exactly what you are looking for but (I think) you can do this with the advanced tab for proxy hosts. If include your whole location slash (/) block and stuff in there you will essentially override everything. Here is an example of an advanced config that I paste into the advanced text box in order to check auth against a custom auth server on otherwise unprotected (static) site: ``` nginx location / { auth_request /auth; auth_request_set $auth_status $upstream_status; proxy_pass http://example.static:4242; # proxy_set_header Upgrade $http_upgrade; # proxy_set_header Connection $http_connection; # proxy_http_version 1.1; # Proxy! #include conf.d/include/proxy.conf; } error_page 401 = @login; location @login { return 302 http://auth1.example.com/authenticate?return=$http_host; } location = /auth { internal; proxy_pass http://auth2.example.com/auth-check; proxy_pass_request_body off; proxy_set_header Content-Length ""; proxy_set_header X-Original-URI $request_uri; } ``` As you can see, almost none of these options are available in the `GUI`, yet nonetheless if you can do it with nginx, or Open Resty (basically nginx with a ton of extra features), you can do it in the advanced box. So you can do one (advanced) host per server block with your config above.
Author
Owner

@hyprem commented on GitHub (Jan 7, 2021):

Dear immanturbo

Thanks for your example! I tried it but it seems to turn the Host imidiently offline. I also teste your working example in my system and the host goes offline imidiently too. Do yoh made any other specific configuration?

Thanks

<!-- gh-comment-id:755899982 --> @hyprem commented on GitHub (Jan 7, 2021): Dear immanturbo Thanks for your example! I tried it but it seems to turn the Host imidiently offline. I also teste your working example in my system and the host goes offline imidiently too. Do yoh made any other specific configuration? Thanks
Author
Owner

@inmanturbo commented on GitHub (Jan 7, 2021):

well no, aside from maybe the fact that all the proxy_pass hosts need to exist? So for instance in my example the auth location needs to exists. Otherwise Nginx will throw an error and won't be able to load.

<!-- gh-comment-id:756335688 --> @inmanturbo commented on GitHub (Jan 7, 2021): well no, aside from maybe the fact that all the proxy_pass hosts need to exist? So for instance in my example the auth location needs to exists. Otherwise Nginx will throw an error and won't be able to load.
Author
Owner

@github-actions[bot] commented on GitHub (Mar 21, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2011038463 --> @github-actions[bot] commented on GitHub (Mar 21, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@github-actions[bot] commented on GitHub (May 2, 2025):

Issue was closed due to inactivity.

<!-- gh-comment-id:2846146322 --> @github-actions[bot] commented on GitHub (May 2, 2025): Issue was closed due to inactivity.
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#679
No description provided.