How to Self-Host WordPress on DigitalOcean (2026 Guide)
Self-hosting WordPress on DigitalOcean is an efficient way to build and manage your website while maintaining full control over its environment. With plans starting at just $6/month, DigitalOcean provides a robust platform for developers and homelabbers who want to run open-source applications. In this guide, you will learn how to set up WordPress on DigitalOcean through a step-by-step process.
Step 1: Create a DigitalOcean Account
- Go to DigitalOcean and sign up. You may need to verify your email address.
- Once your account is verified, log in to the DigitalOcean control panel.
Step 2: Create a Droplet
A Droplet is a scalable virtual private server (VPS) that will host your WordPress site.
- Click on โCreateโ and select โDroplets.โ
- Select the Distribution: Choose an Ubuntu version (e.g., Ubuntu 22.04).
- Choose a Plan: Here is a comparison of DigitalOcean with other VPS providers:
| Provider | Price (per month) | Memory | SSD Disk | Transfer |
|---|---|---|---|---|
| DigitalOcean | $6 | 1 GB | 25 GB | 1 TB |
| Contabo VPS | โฌ5.99 | 4 GB | 200 GB | 2 TB |
| Hetzner Cloud | โฌ4.15 | 2 GB | 20 GB | 20 TB |
| Vultr | $6 | 1 GB | 30 GB | 1 TB |
| Linode (Akamai Cloud) | $5 | 1 GB | 25 GB | 1 TB |
- Choose a Data Center Region: Select a location close to your target audience for lower latency.
- Authentication: Opt for SSH keys for secure access. If you donโt have any set up, you can follow DigitalOceanโs guide to create them.
- Finalize the Droplet: Click on โCreate Droplet.โ
Step 3: Connect to Your Droplet
After your Droplet is created, connect through SSH.
ssh root@your_droplet_ip
Replace your_droplet_ip with your Dropletโs IP address.
Step 4: Prepare the Server
Once connected, update and upgrade your system.
sudo apt update
sudo apt upgrade -y
Install essential packages:
sudo apt install nginx mysql-server php-fpm php-mysql
Step 5: Secure MySQL and Set Up Database
Run the following command to secure your MySQL installation:
sudo mysql_secure_installation
Create a database and user for WordPress:
sudo mysql -u root -p
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wp_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 6: Download and Configure WordPress
Download the latest WordPress package.
wget https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
Move the WordPress files to the Nginx server root.
sudo mv wordpress/* /var/www/html/
Set the proper permissions:
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
Step 7: Configure Nginx
Create a new Nginx server block.
sudo nano /etc/nginx/sites-available/wordpress
Add the following configuration:
server {
listen 80;
server_name your_droplet_ip;
root /var/www/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Enable the configuration by linking it to the sites-enabled directory:
sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
Test the configuration:
sudo nginx -t
If there are no issues, restart Nginx:
sudo systemctl restart nginx
Step 8: Complete WordPress Setup
Open your web browser and navigate to http://your_droplet_ip. You will be guided through the WordPress installation process. Provide the database name, user, and password you created earlier.
FAQs
1. How much does it cost to self-host WordPress on DigitalOcean?
The basic plan for DigitalOcean starts at $6/month, which provides adequate resources for a small- to medium-sized WordPress site. Depending on your website traffic and performance needs, you can scale up your Droplet resources. Itโs a flexible pricing model suitable for developers and homelabbers looking for budget-friendly options.
2. Can I use a Domain Name with My WordPress on DigitalOcean?
Yes, you can use a custom domain name with your WordPress site on DigitalOcean. Youโll need to register your domain with a domain registrar and point the DNS records to your Dropletโs IP address. After that, you can configure Nginx to manage requests for your domain, fulfilling SSL requirements and enhancing security.
3. What are the benefits of self-hosting WordPress on a VPS like DigitalOcean?
Self-hosting WordPress on a VPS like DigitalOcean allows for greater control over your environment, resources, and configurations. Developers can customize settings to suit specific needs, ensuring optimized performance. Additionally, self-hosting enhances privacy since your data is not stored on third-party servers. Consider exploring the r/selfhosted subreddit for community-driven insights on self-hosting applications.
Conclusion
Self-hosting WordPress on DigitalOcean empowers developers and users with the flexibility and control needed for optimal performance. By following these practical steps, youโre well on your way to running a successful WordPress site on a robust VPS. For a broader comparison of VPS providers, visit our full VPS comparison.