Question

Nginx, how to allow IP:PORT requests

Posted February 12, 2021 465 views
NginxInitial Server Setup

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

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.

×
Submit an Answer
1 answer

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