Report this

What is the reason for this report?

NGINX not pointing to localhost

Posted on September 22, 2020

I can access my server running in a Docker container w/ port 0.0.0.0:8080 and 0.0.0.0:5432 (for accessing remote Postgres server on ElephantSQL). I had this running @ one point behind an NGINX server in DigitalOcean but had to recreate my droplet and now I can’t get the config to work again … ugh!.

I CAN access my server via http://dropletIP:8080

When I run my server in a container on my MCB and I run the following NGINX server & configuration on my MCB in another container, I access my server with http://localhost:80.

But when I run the same configuration and servers in my droplet: http://dropletIP:8080 … my server is working but MyDomain.com … server does does not response.

Also… I have MyDomain pointing its A record to www.MyDomain.com and MyDomain.com

Here is my default (no extension) which I have located in \etc\nginx\sites-enabled. (Note: there are no config files in config.d and the default file in sites-available is a mirror of the default config file in sites-enabled.

server {
    listen  [::]:80;
    server_name MyDomain.com www.MyDomain.com;

    location / {
        proxy_pass http://localhost:8080;
#       proxy_set_header Connection "upgrade";
#        proxy_set_header Host $host;
 #       proxy_set_header X-Real-IP $remote_addr;
 #       proxy_cache_bypass $http_upgrade;
 #       proxy_set_header Upgrade $http_upgrade;
        proxy_connect_timeout 60s;
        proxy_send_timeout 60s;
        proxy_read_timeout 60s;
    }
}

my ufw status:

22/tcp                     LIMIT       Anywhere                  
2375/tcp                   ALLOW       Anywhere                  
2376/tcp                   ALLOW       Anywhere                  
5432                       ALLOW       Anywhere                  
Nginx HTTP                 ALLOW       Anywhere                  
80                         ALLOW       Anywhere                  
8080                       ALLOW       Anywhere                  
443                        ALLOW       Anywhere                  
22/tcp (v6)                LIMIT       Anywhere (v6)             
2375/tcp (v6)              ALLOW       Anywhere (v6)             
2376/tcp (v6)              ALLOW       Anywhere (v6)             
5432 (v6)                  ALLOW       Anywhere (v6)             
Nginx HTTP (v6)            ALLOW       Anywhere (v6)             
80 (v6)                    ALLOW       Anywhere (v6)             
8080 (v6)                  ALLOW       Anywhere (v6)             
443 (v6)                   ALLOW       Anywhere (v6)   

and my server container: 0.0.0.0:5432->5432/tcp, 0.0.0.0:8080->8080/tcp

The developer cloud

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

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.