There’s a great guide on how to set up a WordPress droplet on Digitalocean:
… but it stops short of indicating how to set up a subdomain that points to that WordPress instance.
What I’d like to do is set up a subdomain, blog.mydomain.com, which points to the home page (index.html) of that WordPress instance.
Yes, there’s an article on how to set up a subdomain to a domain, but it’s unclear what modifications (if any) to this process are required when working specifically with WordPress:
https://docs.digitalocean.com/products/networking/dns/how-to/add-subdomain/
Thanks for any help you can provide. And apologies in advance if this my question is already answered somewhere.
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.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Hey @alsargent,
First, as you mentioned you need to create a DNS record for your subdomain. Depending on where your DNS is managed at, go there and create two A records. One for blog.mydomain.com and another for www.blog.mydomain.com. Both records should be pointing to your Droplet.
Once that is done, SSH to your Droplet. I’ll assume you’re using Apache or NGINX, as they are the most common web servers. Here are some basic steps for both.
Apache
subdomain.example.com.conf
:In this case, the WordPress files should be located in
/var/www/subdomain
.Please also note, you’ll need to update the settings inside accordingly to your domain.
NGINX
subdomain.example.com
:In both cases, don’t forget to adjust the paths, domain names and PHP versions according to your environment. Also remember to configure DNS for your subdomain to point to the correct server.
Before you start, make sure you have a backup of your server, or at least your current configurations. If something goes wrong, you can always revert to the previous state.
Next, you’ll just need to install WordPress in the directory you have configured in your webservice.