Nginx, how to allow IP:PORT requests

What’s the proper way to configure Nginx to allow IP:PORT requests like this:

//App is deployed on 8086
http://X.X.X.X:8086/?a=xxx&b=yyy&c=zzz ((http requests))
over TCP or UDP

//Another app is deployed on 5050
http://X.X.X.X:5050/postRequest (http requests)
over TCP or UDP

My nginx.conf

server {
        include /etc/nginx/conf.d/*.conf;
       listen         80 default_server;
       listen         [::]:80 default_server;
       server_name    _;
       root           /home/ubuntu/var/www/html;
       index          index.html index.htm default.html;
       access_log /etc/nginx/logs/access.log mycustomformat;

My PM2 have multiple applications deployed I want to access them by <IP>:<PORT>/request



Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

If you need to access your applications on IP:PORT, there is no need to use Nginx. For example, you could start multiple Docker containers on different ports, and access them directly on those ports.

Ngnix would come in handy if you want to “hide” the ports, in this case you could setup Nginx as a reverse proxy:

Hope that this helps! Regards, Bobby