Setting up domain with WordPress

July 31, 2019 342 views
Initial Server Setup Getting Started Ubuntu 18.04 WordPress

Hey,

Looking at DigitalOcean for hosting my WP Site. It’s the cheapest but I am a bit of a noob so sorry if this is a really dumb question.

Once I’ve migrated my site, and it’s on the IP I get for my droplet and I am ready to go live and switch hosts. I then go into networking, put it in, and then put the details in on my website etc.

Do I just set the WordPress Address (URL) and Site Address (URL), to my domain and it should work from there?

Thanks

1 Answer

Hello,

Before making the DNS change I would recommend testing your website with your hosts file.

You can edit the hosts file on your PC to bypass the DNS lookup and access the site on your Digital Ocean server through your main domain rather than the droplet’s IP address.

This only affects your PC and visitors to your website will see the site as normal.

The location of the file is as follows:

Windows PC c:/windows/system32/drivers/etc/hosts

Mac OSX /private/etc/hosts

Linux /etc/hosts

Just open it up in your favorite text editor (e.g. Notepad) and add that line on the bottom:

Your.Droplets.IP.Address yourdomain.com www.yourdomain.com

Make sure tho change the Your.Droplets.IP.Address with the actual IP address of the droplet and the yourdomain.com part with your actual domain

Once you have made the change, save the file then clear your browsers’ cache and browse to your website as normal.

You will see it served from our systems and will be able to test the full functionality of your Wordpress site.

To view the site on your existing host, just remove the line from your hosts file. If everything is working as normal, then you can proceed with the DNS change and point your domain to the Droplet’s IP address.

Also I would recommend following this step by step guide on the Digital Ocean website on how to migration your website with zero downtime:

https://www.digitalocean.com/community/tutorials/how-to-migrate-wordpress-from-shared-hosting-to-a-cloud-server-with-zero-downtime

Let me know if you have any questions.
Bobby

by Ramesh Jha
If you read through this article you'll have the knowledge to migrate your WordPress site from Shared Hosting to a Cloud Server with zero downtime.
  • OK thank you.

    I should we able to access the site from the Droplet IP though?

    Although my question still remains. Once I have migrated my site and set up WordPress with the Droplet IP, how do I go about setting my domain to go to this. If I just add my domain and set the NS and put the Site and WordPress URL in order for this to work?

    Or do I do that + Step 4 on the link you sent me?

    Thanks,
    Albert

    • Hello,

      Yes you can follow the instructions in Step 4, it is always good to use Vhosts. Then it would be easier for you to install an SSL for your domain name if you decide to do so.

      Let me know if you have any questions!
      Bobby

      • Hi Bobby,

        So Step 4 is optional? Is it not possible to install an SSL Certificate without it?

        Can I just add the domain in networking, set wordpress to that domain, and then you will be able to access it through the domain? Would I be able to install SSL if that does work?

        Thanks

        • Hello,

          Yes your site will work without the Vhost. As long as your Domain names A record is pointing to your droplet’s IP address and you’ve got your Wordrpress site and home URLs setup correctly it should work as expected.

          However, for the SSL certificate I would suggest adding a Vhost for your domain name. Essentially how you install an SSL for Apache is by adding a Vhost for port 443 and specifying your SSL files there. So it is good to have a working Vhost for your site for port 80 ready, and when you decided to install an SSL you can just use it and refactor it for port 443.

          Hope that this helps!
          Regards,
          Bobby

Have another answer? Share your knowledge.