DigitalOcean is a powerful cloud hosting platform that offers excellent performance and scalability for hosting WordPress websites. In this blog post, we will walk you through the step-by-step process of getting started with DigitalOcean for WordPress hosting. From registration and droplet setup to LAMP installation and WordPress setup, we’ve got you covered. We will also guide you on how to connect your Google domain to your DigitalOcean droplet for a seamless website experience.
Step 1: Registration on DigitalOcean:
To begin, follow this referral link: https://m.do.co/c/3310abfe2cc4 to sign up for a DigitalOcean account. By using the referral link, you will receive some credits that can be used towards your hosting costs.
Step 2: Droplet Setup:
- Once registered, log in to your DigitalOcean account.
- Click on the “Create” button and select “Droplets.”
- Choose the desired configuration for your droplet, such as the server location, size, and operating system (Ubuntu 20.04 LTS is recommended).
- Select additional options like backups and monitoring if needed.
- Set a hostname for your droplet, and click on “Create Droplet” to proceed.
Step 3: LAMP Setup using PuTTY (Windows):
- Download PuTTY from the official website – putty.org and install it on your computer.
- Launch PuTTY and enter your droplet’s IP address.
- In the left-hand menu, navigate to “Connection” > “SSH” > “Auth.”
- Browse and select your private key file (.ppk) for authentication.
- Return to the “Session” section, enter a name for your session, and click “Save.”
- Click “Open” to establish the SSH connection with your droplet.
- Once connected, run the following commands to install LAMP:
- Update package lists:
sudo apt update
- Install Apache web server:
sudo apt install apache2
- Install MySQL server:
sudo apt install mysql-server
- Secure MySQL installation:
- Install PHP and required modules:
sudo apt install php libapache2-mod-php php-mysql
- Restart Apache:
sudo systemctl restart apache2
- Update package lists:
Step 4: WordPress Setup:
- Download the latest WordPress package from the official website.
- Use an FTP client to upload the package to the web server’s document root directory (/var/www/html).
- Extract the WordPress package:
sudo unzip wordpress.zip
- Rename the sample configuration file:
sudo mv wp-config-sample.php wp-config.php
- Open wp-config.php and update the database details:
- Database name: Replace ‘database_name_here’ with your chosen name.
- Username: Replace ‘username_here’ with your MySQL username.
- Password: Replace ‘password_here’ with your MySQL password.
- Save the changes and close the file.
- Access your website in a browser to start the WordPress installation.
- Enter your domain or IP address in the address bar.
- Follow the on-screen instructions to complete the installation.
Step 5: Google Domain Connection with DigitalOcean:
- Log in to your DigitalOcean account.
- In the DigitalOcean dashboard, click on the “Networking” tab at the top and select “Domains” from the dropdown menu.
- Click on the “Add Domain” button.
- Enter your domain name and click on “Add Domain” to proceed.
- After adding the domain, you will see a list of DNS records.
- Take note of the three nameservers provided by DigitalOcean (e.g., ns1.digitalocean.com, ns2.digitalocean.com and ns3.digitalocean.com).
Step 6: Update Google Domain DNS Settings:
- Log in to your Google Domains account.
- Navigate to your domain management page.
- Under the “DNS” tab, scroll down to the “Name servers” section.
- Select the option “Use custom name servers.”
- Enter the DigitalOcean nameservers you obtained in Step 5 (e.g., ns1.digitalocean.com, ns2.digitalocean.com and ns3.digitalocean.com).
- Click on “Save” to update the DNS settings.
Step 7: Configure DNS Records in DigitalOcean:
- Go back to the DigitalOcean dashboard and click on the domain name you added in Step 5.
- In the domain settings page, click on the “DNS” tab.
- Add the necessary DNS records for your Google domain to connect with your DigitalOcean droplet.
- Add an A record:
- Enter “@” in the “Hostname” field.
- Enter your droplet’s IP address in the “Will direct to” field.
- Click on “Save” to add the A record.
- Add a CNAME record for the “www” subdomain (optional):
- Enter “www” in the “Hostname” field.
- Enter “@” in the “Will direct to” field.
- Click on “Save” to add the CNAME record.
- Add an A record:
Step 8: Wait for DNS Propagation:
- DNS propagation can take some time, usually ranging from a few minutes to several hours.
- It’s recommended to wait for the changes to propagate globally before proceeding.
By following these steps, you have successfully set up DigitalOcean for WordPress hosting. From registering on DigitalOcean, setting up your droplet and LAMP stack using PuTTY, to installing WordPress and connecting your Google domain with DigitalOcean, you are now ready to build and manage your WordPress website with ease. Enjoy the benefits of DigitalOcean’s powerful infrastructure and unleash the full potential of your WordPress site.