Hello, I am running one droplet with nginx configured for running a wordpress installation. I bought another TLD and would like to host that domain from the same server too. I followed the DO tutorial on how to configure the second site which tells making a new directory in the www directory and I did so along with the other settings.
Now how do I configure the A record or the CNAME for the second TLD in the DO domain settings please?
Here are the basic info:
Any article or suggestion on that please? Much appreciated.
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!
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.
When it comes to A and CNAME entries, you’ll point both domains’ A entries to the same IPv4 IP. The CNAME would simply point
wwwto the domain so that you can use either or to access it.
DROPLET_IPis the IPv4 IP of your Droplet and
domain.comis your domain name.
When it comes to the
serverblocks, as long as the domain is pointing to the IP where you’ve setup the server block for the same domain, that should be all that’s needed.
For example, if we have
domain02.comand you’ve setup the same A/CNAME entries (as shown above), then you’d have at least two server blocks, one for each domain.
Of course, the above won’t handle PHP files, though we can fix that easily by adding another location block under the first. That’d look like this:
I’m using TCP instead of Sockets for
fastcgi_pass, though you can replace that as needed. So we could have the server blocks setup like:
For SSL, things are a little different. We’d use something like this instead (for each domain):
The above allows us to redirect requests on port 80 to 443 so that everything is covered by SSL. This is a bit more detailed than what the guides cover, but I use similar in production, so I figured that’s what I’d give as an example.
The above assumes HTTP2 is enabled on your NGINX version. If it’s not, you may need to remove
@mcmurphy Can you post your Nginx configuration? It’ll be easier for us to help.
Want to learn more? Join the DigitalOcean Community!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Sign up now