Question

Can domain records exist in both the original registrar and also in Digital Oceans network pane?

I have a client that wants to maintain control of his domain (fair enough) - he also wants to maintain control of his MX records (fair enough). He is with CrazyDomains and the current records kind of look like this:

Before CrazyDomains:

After CrazyDomains:

DO:

  • A Name: @ 666.777.888.999

Essentially I can maintain the A Name records (via DO) and he can maintain the MX records (via CrazyDomain)


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

@cjke7777

NGINX can work as a load balancer and/or a proxy, which is the beauty of it all :-).

For the purpose of this example, let’s say we have 3 clients we need to manage (i.e. host their sites).

clientdomain01.com
clientdomain02.com
clientdomain03.com

Also for the purpose of this example, I’ll be setting up 3x 1GB Droplets. Once live, I’ll SSH in to each and run:

sudo apt-get update \
&& sudo apt-get -y upgrade \
&& sudo apt-get -y install nginx

Once finished, NGINX is installed on all three Droplets.

Now, for the purpose of identifying the servers, when I reference Droplet #, you’ll know which one I’m talking about by looking at the below.

Droplet 01 = Load Balancer/Proxy (lb01.mydomain.com)
Droplet 02 = Web Server (nginx01.mydomain.com)
Droplet 03 = Web Server (nginx02.mydomain.com)

On Droplet 01

cd /etc/nginx/sites-available

Inside this directory you’ll find a file called default. We’ll delete that and start fresh.

rm default

Now, we’ll create files for each of our client domains:

touch clientdomain01.com.conf \
&& touch clientdomain02.com.conf \
&& touch clientdomain03.com.conf

Now we’ll modify each one, for each client.

nano clientdomain01.com.conf

Inside clientdomain01.com.conf, paste:

upstream backendOne  {
    server nginx01.mydomain.com;
}

server {
    server_name clientdomain01.com www.clientdomain01.com;

    location / {
        proxy_pass http://backendOne;
    }
}

Inside of clientdomain02.com.conf, paste:

upstream backendTwo  {
    server nginx02.mydomain.com;
}

server {
    server_name clientdomain02.com www.clientdomain02.com;

    location / {
        proxy_pass http://backendTwo;
    }
}

Inside of clientdomain03.com.conf, paste:

upstream backendOne  {
    server nginx01.mydomain.com;
}

server {
    server_name clientdomain03.com www.clientdomain03.com;

    location / {
        proxy_pass http://backendOne;
    }
}

What the above does is send requests for:

clientdomain01.com
clientdomain03.com

… to Droplet 01 – it’ll send requests for clientdomain02.com to Droplet 02.

Droplet 02 and Droplet 03

The configuration on both of these Droplets will be minimal to start as this is just an example, but you will configure these two as you would any standard NGINX web server.

To get started here, we’ll delete the default file again and start fresh on both, but we’ll need to add in specifics to our server blocks to handle the proxied requests from Droplet 01.

So since Droplet 02 is going to handle two domains, we’ll start there.

cd /etc/nginx/sites-available
rm default \
&& touch clientdomain01.com.conf \
&& touch clientdomain03.com.conf

We’ll start with clientdomain01.com.conf

nano clientdomain01.com.conf

Paste in:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    server_name clientdomain01.com www.clientdomain01.com;

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

Now for clientdomain03.com.conf

nano clientdomain03.com.conf

Paste in:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    server_name clientdomain03.com www.clientdomain03.com;

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

Now we can move on to Droplet 03 and do the same:

cd /etc/nginx/sites-available \
&& rm default
nano clientdomain02.com.conf

Paste in:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    server_name clientdomain02.com www.clientdomain02.com;

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

Restart NGINX

Now, on all 3 servers, restart NGINX:

systemctl restart nginx

With the above configuration, requests for clientdomain01.com and clientdomain03.com will hit Droplet 02 while requests for clientdomain02.com will hit Droplet 03.

Where to Point A Entries

All A entries for the three domains would point to the IP of the load balancer (Droplet 01). Now the only IP that clients are aware of is the one associated with the load balancer.

So for example, if you move clientdomain01.com from Droplet 02 to Droplet 03, you’d simply modify your configuration on the load balancer to point them to the other server and:

systemctl reload nginx

and it’s live again. They don’t need to know about the IP’s for Droplet 02 or Droplet 03.

This is an Example

Obviously, PHP, MySQL, etc isn’t installed here. You’d need to install those on Droplet 02 and Droplet 03 just as we did NGINX.

This can get even more complex, though for the purpose of showing what you can do, I hope this helps a bit. If you have any questions, feel free to ask.

You cannot do this, the nameservers of the domain determine which DNS servers are used.

@Woet Thanks for the quick reply!

Is there an alternative to this? I’ve been thinking something like a static ip that I can map onto a server, then give the IP to the client, and I can repoint the static IP (almost like a floating IP). The only reason I am not using a floating IP is because there are few services not running on DO (gasp).

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

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

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.