Unable to get multple ip v4 ports active

Please use this template for troubleshooting questions.

My issue: Not possible to address multiple ports to one ip-address

How I encountered the problem: the llsten directive 192.168.1.25:80 and in a other website config file iisten 192.168.1.25:8080 are not giving the ports in sudo netstat -lntp.

Only one listen set can be selected

Solutions I’ve tried:

Version of NGINX or NGINX adjacent software (e.g. NGINX Gateway Fabric):

NGINX 1.29.4 Ubuntu 24.04

Deployment environment:

To create more security for a ERP application, the need is there to use a other port then for the websites already active

Minimal NGINX config to reproduce your issue (preferably running on https://tech-playground.com/playgrounds/nginx for ease of debugging, and if not as a code block): (Tip → Run nginx -T to print your entire NGINX config to your terminal.)

NGINX access/error log: (Tip → You can usually find the logs in the /var/log/nginx directory.)

No errors in any log file

Hmm, this seems to work fine for me

server {
        server_name   localhost;
        listen        [::1]:4040;
	    listen        [::1]:8080;

	    root	      /srv/nginx;
}
$ ss -tunlp | grep nginx
tcp   LISTEN 0      511            [::1]:4040          [::]:*    users:(("nginx",pid=84363,fd=6),("nginx",pid=84362,fd=6))
tcp   LISTEN 0      511            [::1]:8080          [::]:*    users:(("nginx",pid=84363,fd=7),("nginx",pid=84362,fd=7))
$ curl localhost:4040/
Hello World
$ curl localhost:8080/
Hello World

Update: Also works with IPv4…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.