Unable to point domain to IP

March 13, 2018 930 views
Deployment DNS Django Nginx Ubuntu 16.04
mnyu
By:
mnyu

I'm having issues pointing my domain to my IP.

My django app is deployed at : http://159.203.117.240/ without an issue, but I cannot point a domain I bought: magnacreativelabs.club to the IP.

My Domain has a custom DNS of:
ns1.digitalocean.com
ns2.digitalocean.com
ns3.digitalocean.com

And my DNS configuration in DigitalOcean looks like:

A *.magnacreativelabs.club directs to 159.203.117.240
A magnacreativelabs.club directs to 159.203.117.240
A www.magnacreativelabs.club directs to 159.203.117.240

NS magnacreativelabs.club directs to ns3.digitalocean.com
NS magnacreativelabs.club directs to ns1.digitalocean.com.
NS magnacreativelabs.club directs to ns2.digitalocean.com.

Even further:

my /etc/sites-available/MYAPP looks like:

server {

listen 80;
server_name magnacreativelabs.club;

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
    root /home/michael/magna/magna/magna;
}

location / {
    include proxy_params;
    # proxy_pass http://159.203.117.240;
    proxy_pass http://unix:/home/michael/magna/magna/magna.sock;
}

}

and /etc/sites-available/default looks like:

server {
listen 80 defaultserver;
listen [::]:80 default
server;

    root /var/www/html;

    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
            try_files $uri $uri/ =404;
    }

}

Any help would be appreciated!

2 Answers
AlexeiRamone March 13, 2018
Accepted Answer

Real issue maybe your sites-enabled not symlinked. Run this on terminal:

  • sudo ln -s /etc/nginx/sites-available/*.conf /etc/nginx/sites-enabled/

Nginx uses two separate folders, only confs in sites-enabled run.

You only need one A and a CNAME record to make it work.

  • Keep only this A record: A magnacreativelabs.club directs to 159.203.117.240 removing other A's.
  • Add a CNAME named www pointing to @
  • nginx server_name .magnacreativelabs.club;
  • when i ran that command it created a file " *.conf " that is unlinked. and both my files in sites-enabled/ are linked

    • [deleted]
    • You don't use the conf extension so the proper command would be symlinking just *

      The default server is responding. MAYBE nginx is including it BEFORE your myapp file. Delete this file. Add the default server in the main nginx.conf file after including sites-enabled files.

      My nginx.conf

      http {
              ...
              include /etc/nginx/sites-enabled/*;
              server {
                  listen 80 default_server;
                  server_name _ "";
                  return 444;
              }
      }
      
      
  • I did make all the changes you suggested and i hate to say they didn't solve the problem. however, i really appreciate your help :)

  • additionally, should I keep the NS records?

  • If its any help this is what my chrome displays when i try to access my domain:

    This site can’t be reached
    magnacreativelabs.club refused to connect.
    Try:

    Checking the connection
    Checking the proxy and the firewall
    ERRCONNECTIONREFUSED

I have issues pointing my droplet to cloudflare. Would be great if someone can help me!
Thanks

Have another answer? Share your knowledge.