nginx-proxy-manager icon indicating copy to clipboard operation
nginx-proxy-manager copied to clipboard

Stream port ranges

Open pizzaandcheese opened this issue 2 years ago • 10 comments

have a simple addition I would like to request. The ability to forward port ranges for streams.

According to the docs for Nginx it should be possible. https://nginx.org/en/docs/stream/ngx_stream_core_module.html#listen Although when I attempt to forward a range in NPM it requires me to input 1 port number and won't accept a range.

pizzaandcheese avatar Mar 31 '22 14:03 pizzaandcheese

I am also needing this feature, I have around 4,000 ports I need to setup and doing it one at a time is not really feasible. If anyone has any other work arounds please let me know.

sanegaming avatar Apr 20 '22 04:04 sanegaming

So, I thought I'd have a look at the conf file generated by NPM. In my case I'm using the Alpine script for Proxmox. This puts the conf file in /data/nginx/stream/x.conf . Here's the code ouput for one of the files.

# ------------------------------------------------------------
# <PORT> TCP: 1 UDP: 1
# ------------------------------------------------------------


server {
  listen <PORT>;
listen [::]:<PORT>;


  proxy_pass <FORWARD_IP>:<PORT>;

  # Custom
  include /data/nginx/custom/server_stream[.]conf;
  include /data/nginx/custom/server_stream_tcp[.]conf;
}


server {
  listen <PORT> udp;
listen [::]:<PORT> udp;

  proxy_pass <FORWARD_IP>:<PORT>;

  # Custom
  include /data/nginx/custom/server_stream[.]conf;
  include /data/nginx/custom/server_stream_udp[.]conf;
}

So, I thought in my brilliance, I'd just modify the file with a port range at the end. Aparently, that's not how this works because now NPM doesn't load it's web interface at all. If someone thinks I might be on to something here, feel free to modify my screw up and see if this can be accomplished.

# ------------------------------------------------------------
# <PORT-START>-<PORT-END> TCP: 1 UDP: 1
# ------------------------------------------------------------


server {
  listen <PORT-START>-<PORT-END>;
listen [::]:<PORT-START>-<PORT-END>;


  proxy_pass <FORWARD_IP>:<PORT-START>-<PORT-END>;

  # Custom
  include /data/nginx/custom/server_stream[.]conf;
  include /data/nginx/custom/server_stream_tcp[.]conf;
}


server {
  listen <PORT-START>-<PORT-END> udp;
listen [::]:<PORT-START>-<PORT-END> udp;

  proxy_pass <FORWARD_IP>:<PORT-START>-<PORT-END>;

  # Custom
  include /data/nginx/custom/server_stream[.]conf;
  include /data/nginx/custom/server_stream_udp[.]conf;
}

Thanks in advance.

odjhl88 avatar May 15 '22 21:05 odjhl88

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

github-actions[bot] avatar Feb 20 '24 01:02 github-actions[bot]

Please continue to consider.

sanegaming avatar Mar 01 '24 00:03 sanegaming

just had to enter a large range manually, this would be an amazing feature to have.

scroguard avatar Apr 01 '24 16:04 scroguard