Report this

What is the reason for this report?

Nginx, how to allow IP:PORT requests

Posted on February 12, 2021

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

Thanks



This textbox defaults to using Markdown to format your 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:

https://www.digitalocean.com/community/questions/how-to-host-multiple-docker-containers-on-a-single-droplet-with-nginx-reverse-proxy

Hope that this helps! Regards, Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.