Home > Enterprise >  How do I properly configure nginx for domain name access?
How do I properly configure nginx for domain name access?

Time:01-14

There is such a config

server {
    listen 8080;
    server_name 18.157.238.183 team-mate.app www.team-mate.app;
    location / {
        proxy_pass http://127.0.0.1:8000;
    }
    location /static/ {
    root /app;
    }
}

The website opens by ip address

18.157.238.183:8000

but not the domain name

Hosting has the following configuration (it has been a few days since A was added) enter image description here

CodePudding user response:

dig team-mate.app shows two A records (I guess the second one is the "Parked" one from your screenshot):

;; ANSWER SECTION:
team-mate.app.      443 IN  A   18.157.238.183
team-mate.app.      443 IN  A   34.102.136.180

The second one obviously doesn't reach your server, and is at the moment not listening to port 8000.

If you want to test it locally, you can add an entry in /etc/hosts with the 18.157.238.183 IP so you are sure to hit this, and when you are ready to go live, you should change the DNS to have a single A record (or run your nginx also at the second IP), otherwise 50% of the requests will fail.

  • Related