How Set Up WordPress on DigitalOcean
DigitalOcean WordPress Setup Step-By-Step
DigitalOcean provides scalable VPS for developers and website builders.
You can configure servers exactly as you like with root access and SSH / SCP for access.
I have been using DigitalOcean for a year, and I love using it over many other managed services.
It does mean you need to be comfortable using a command-line terminal and you’ll need to be familiar with Linux commands and SSH.
I wrote this article to show how quickly and easily you can configure a WordPress site.
Choose a region
Choose the data centre closest to your primary market or audience.
When you select “Enable backups”. Digital Ocean will automatically backup your droplet once a week.
(Initially, a backup will be created immediately on completion of your build.)
(You will have the option to create Snapshot backups later).
(There is an additional change for backup approximately $2 per month on this Droplet size).
Additional options and SSH Key.
(We’ll skip the networking options in this example).
There is no FTP option on DigitalOcean which is a good thing.
FTP servers are more often attacked than SSH historically and password can be easily compromised.
SSH and SCP are used to copy data to your droplet.
You can use the command line to copy data or software like Filezilla or Panics Transmit for MAC users.
Here you will create an SSH key that is used to provide you with secure access to your Droplet..
Create a backup of your existing keys.
It’s very easy to create an SSH Keypair if you are using a Mac.
We recommend that you backup any existing SSH keys beforehand if you have used ssh or scp previously.
We can back up existing ssh keys easily done using the zip utility on MAC.
To backup your existing ssh keys.
1) Open your terminal and type zip -e ~/mykeys.zip ~/.ssh. .
2) Type in a memorable password. You will need to enter this a second time.
This creates a backup file in your home directory.
This command will compress and encrypt the content of the default key pair directory in a file called mykeys.zip in your home directory.
Create A New SSH Key Pair.
It takes just one line to create the Key Pair.
-> ssh-keygen -t rsa -b 4096.
Then press return for each prompt until the command finishes.
(The Key Pair is so called because two keys are created that have a mathematic relationship to each other.)
These Key are created in two separate files called id_rsa and id_rsa.pub.
These pairs are unique and mathematically related to each other.
The .pub is your public key; this is the key we will copy to DigitalOcean.
The other file is the private key, and it should never be made public.
Add Your New SSH Key Pair To the Droplet for SSH Access.
The last part is to add your SSH public key to the DigitalOcean Droplet.
Click the Add SSH Key button.
The command pbcopy will copy the contents of the public key file to your copy-paste buffer.
-> pbcopy < ~/.ssh/id_rsa.pub
Now you can just press control -V to paste the key into the SSH Access section.
Provide a meaningful name for this device’s key.->
Completing SSH Access setup.
Click the Add new SSH Key to the Droplet by clicking on the New SSH Key Button.
Then using shift- cmd – V paste your public key.
Provide a meaningful name that references your computer.
You will need to add an SSH key pair per computer or device.
A new check button will appear to allow access by the named sshkey.
Ensure this is checked.
Finishing the Setup
When the droplet creation is completed, see it add the the droplets list along with its assigned IP address. The droplet shows wether or not the backup is activated for this droplet.
We could connect to this droplet now using the IP address in a browse.
But let’s configure our domain first as this will make WordPress configuration easier.
DigitalOcean is a great service provider but it is not a domain registrary.
You will need to purchase and register your domain name with a Domain register such as ionos.co.uk.
When you have bought a domain name from a registrar like IONOS you will have access to a DNS control panel.
In order to use your domain with DigitalOcean you must set the namerservers settings to point to DigitalOcean.
This is done by adding the following name servers to your registrars setting for your domain.
Now you need to add the domain to your DigitalOcean account.
Add a domain name.
It’s easy to add your domain to DigitalOcean.
Once you have told ionos.co.uk to point nameservers to DigitalOcean, within a few minutes you will be able to add the domain name.
In your DigitalOcean control panel, click on Networking on the left hand side menu which is about 3/4 of the way down.
In the next section type @ in the first text box.
Use the chooser box to chose the droplet by IP address or the droplet name we just created (The one you wish to use for this domain).
Click the Blue “Create Record” Button.
Now your domain is assign to the droplet.
In a few seconds you can goto your browser and type http://your-domain-name.com.
When you navigate to your droplet you will see a message telling you that the WordPress setup is not yet completed.
There is a security procedure to ensure that this is a legitimate startup of WordPress setup.
To start the WordPress set, you just need to login to your droplet using your SSH key.
In your terminal type:-
-> ssh [email protected]
This will login you on to your droplet at the operating system level
You will see some messages to say that you droplet is now building.
Now when you use your browser to navigate to your domain again in a few seconds, you will be able to run the WordPress setup.