Nginx – How to point CNAME to Digital Ocean droplet

cname-recorddomain-name-systemnginxUbuntu

Having an issue trying to point a CNAME to my Digital Ocean droplet

I created a CNAME on DNSimple and pointed it to the IP address of my Digital Ocean droplet: ironman4x4.adamgeorge.com

I've tested that it exists:

→  ~  host -t cname ironman4x4.adamgeorge.com
ironman4x4.adamgeorge.com is an alias for 128.199.176.45.

My Digital Ocean droplet was created using this guide:

https://www.digitalocean.com/community/tutorials/how-to-use-the-1-click-ruby-on-rails-on-ubuntu-14-04-image

The 1-click install creates a default site here which I tried customising the root and server_name options:

server {
        listen   80;
        root /home/rails/current/public;
        server_name _ ironman4x4.*;
        index index.htm index.html;

        client_max_body_size 5M;

        location / {
                try_files $uri/index.html $uri.html $uri @app;
        }

    location ~* ^.+\.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|flv|mpeg|avi)$ {
                        try_files $uri @app;
                }

         location @app {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_redirect off;
                proxy_pass http://app_server;
    }

}

Not sure why it's not working.

I can't SSH onto the server via ssh root@ironman4x4.adamgeorge.com, nor does Nginx respond via http://ironman4x4.adamgeorge.com

Not sure why?

Is there anything else I need to configure for either the DNS or or the droplet to get this to work?

Best Answer

The CNAME record type makes one name into an alias of another name.

Ie, the value of your CNAME record is not an IP address but a name with all-numeric labels.

You probably simply want to create an A record instead.

Related Topic