Question

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

Thanks


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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