I am using a virtual private server to host my blog and my other site. The principal advantage you have using a VPS is that you have all the control on your private server. The cost is lower then a dedicated and higher than a shared hosting. I am using Digital Ocean and I am recommend it to every one.
Warning : You should have basic skill in computer to host your blog on a VPS. If you don’t have any skill or you don’t want to troubleshoot some problem read this post about Shared hosting.
1. Sign up to Digital Ocean
Step 1 – Registration DigitalOcean
1. First Click HERE
2. Click Sign Up
3. Fill Email and Password and click Sign Up
4. Open the email to confirm your registration
Step 2 – Billing Update
In the Billing section, you need to add a Credit Card or PayPal account. I recommend just use a PayPal account and add money in it when you need it.
1. Click Update Billing option
2. Select only PayPal, scroll down please make payment. To be safer, deposit only $ 10 or $5
3. Select Pay with my PayPal account
4. In the PayPal page, log in your Paypal account and click on pay
5. The deposit will be added to your account
You also get free $10 credit for the first time. That mean you have total $15 credit. With this credit you can create one VPS for three months.
2. Create your Droplet
Step One — Log In
To create your first Droplet go to the DigitalOcean Control Panel and log in with your email and password. The create button will be right there on the first page: click on “Create Droplet”:
Step Two — Select Droplet Image
You can create your Droplet image from 2 possible categories:
I recommend to choose the distribution Debian and select the latest version available.
Step Three — Select Your Droplet’s Size
Depending on your budget and your traffic, you can select the Droplet option that works best for you.
Since you can upgrade after the installation and if you are starting a blog, I recommend using the $5 / month droplet to start and upgrade it if it’s too slow.
Step Four — Select Your Droplet Region
You may choose the most effective region for your Droplet location. They are all the same thing but I recommend that you use the nearest to your readers since it will have least latency and faster response.
Step Five — Select Additional Options
The Select additional options section allows you to select which features you would like your Droplet to have:
Since we are hosting only a blog, I will not use any additional options.
Step Six— Select the Number and Names of the Droplets to Create
Next, you can choose the number and names of the Droplets you wish to create. You only need one droplet to host a wordpress blog.
Each Droplet must have a name. This name will be used in the DigitalOcean control panel and as the server’s hostname. You may use your domain name to recognize easily your droplet.
Step Seven— Create Your Droplet
Once you have selected all of your preferred options, click on “Create”. After your Droplet is created, its root password will arrive in your email inbox and the Droplet will be set up.
Now your server is ready to install the web sever.
3. Configure and install the web server on the VPS
Step One – Log In With Windows
To log in to your Droplet on Windows, you will need to have PuTTY, an SSH client, installed on your computer.
- You can download the program here. Choose the Windows installer.
- Once PuTTY is downloaded and installed, starting the program will take you to the configuration screen.
- Fill in the “Host Name (or IP address)” field with the Droplet IP address from the DigitalOcean control panel. Make sure that the port number is 22 and that the connection type is SSH.
- Click on Connect. After PuTTY starts up, type in the root password that was emailed to you.
You will then be connected to your DigitalOcean Droplet.
Step Two—Install Apache
To install apache, open terminal and type in these commands:
apt-get install apache2
That’s it. To check if Apache is installed on your VPS, direct your browser to your server’s IP address (eg. http://126.96.36.1999). The page should display the words “It works!”.
Step Three—Install MySQL
To install MySQL, open terminal and type in these commands:
apt-get install mysql-server
During the installation, MySQL will ask you to set a root password. If you miss the chance to set the password while the program is installing, it is very easy to set the password later from within the MySQL shell.
Finish up by running the MySQL set up script:
The prompt will ask you for your current root password.
Type it in.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Then the prompt will ask you if you want to change the root password. Go ahead and choose N and move on to the next steps.
It’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
Remove anonymous users? [Y/n] y
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
- Removing privileges on test database...
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
Once you’re done with that you can finish up by installing PHP on your virtual server.
Step Four—Install PHP
PHP is an open source web scripting language that is widely use to build dynamic webpages.
To install PHP, open terminal and type in this command. Note: If you are on a version earlier than Debian 7, include php5-suhosin as well.
apt-get install php5 php-pear php5-mysql
After you answer yes to the prompt twice, PHP will install itself.
Finish up by restarting apache:
service apache2 restart
4. Buy and Configure your domain
Step One – Register to namecheap
Click here to register for an account on namecheap. Follow the sign up link on the top of the page.
Set Two – Register a domain name
Choose your domain name and write it in the search box and click Search.
If your domain is available click on the cart logo to add it to your cart and click on “View Cart”
I always keep the default option and click on Confirm Order and pay it.
You are now the owner of the domain.
Step Three – Configure your domain name
Go to your dashboard and select Manage at the right of your domain.
On the top, click on “Advance DNS”
Select “Add New Record” and select a “A Record” in this first entry, and the second replace the www with “@” and add the IP address of your digital ocean server and click on the check.
Your domain name now point on your server. It will take about 24h to be active on all ISP around the world.
5 . Configure and install WordPress on the VPS
Now that the web server is installed and the domain name is configured, it’s time to configure a WordPress blog.
Step One – Download WordPress
We can download WordPress straight from their website:
The next command will now download the zipped WordPress package straight to your user’s home directory:
tar -xzvf latest.tar.gz
Step Two – Create WordPress Database and User
After we unzip the WordPress files, they will be in a directory called “wordpress” in the home directory.
MySQL Directory For WordPress
We need to take a moment and create a new MySQL directory for WordPress. Go ahead and log into the MySQL Shell:
mysql -u root -p
*Now let’s make the database.
This tutorial will call its database wpdatabse for simplicity’s sake– feel free to give it whatever name you choose):
CREATE DATABASE wpdatabase;
Query OK, 1 row affected (0.00 sec)
Then we need to create the new user. You can replace the database, name, and password, with whatever you prefer:
CREATE USER wpuser@localhost;
Query OK, 0 rows affected (0.00 sec)
Set the password for your new user:
SET PASSWORD FOR wpuser@localhost= PASSWORD("dbpassword");
Query OK, 0 rows affected (0.00 sec)
Finish up by granting all privileges to the new user. Without this command, the wordpress installer will not be able to start up:
GRANT ALL PRIVILEGES ON wpdatabase.* TO
wpuser@localhost IDENTIFIED BY 'dbpassword';
Query OK, 0 rows affected (0.00 sec)
Then refresh MySQL:
Query OK, 0 rows affected (0.00 sec)
Exit out of the MySQL shell:
Step Three – Setup the WordPress Configuration
The first step to is to copy the sample wordpress configuration file, located in the wordpress directory, into a new file which we will edit, thus creating a new usable wordpress config:
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
Then open the wordpress config:
sudo nano ~/wordpress/wp-config.php
Find the section that contains the field below and substitute in the correct name for your database, username, and password:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
/** MySQL database username */
/** MySQL database password */
Save and Exit.
Step Four – Copy the Files
We are almost done uploading WordPress to the virtual private server. The final move that remains is to transfer the unzipped WordPress files to the website’s root directory.
sudo rsync -avP ~/wordpress/ /var/www/
Finally we need to set the permissions on the installation. First, switch in to the web directory:
Give ownership of the directory to the Apache user. www-data is the Apache user. You are also going to add your personal user to the www-data group so you don’t lose access to the files. You should replace username with the username you created earlier, and which you should be logged in as right now.
sudo chown www-data:www-data /var/www/* -R
sudo usermod -a -G www-data username
From here, WordPress has its own easy to follow installation form online.
However, the form does require a specific php module to run. If it is not yet installed on your server, download php-gd:
sudo apt-get install php5-gd
Step Five – Access the WordPress Installation
Once that is all done, the wordpress online installation page is up and waiting for you:
Access the page by adding /wp-admin/install.php to your site’s domain or IP address (eg. example.com/wp-admin/install.php) and fill out the short online form (it should look like this).
To see the WordPress site, we will need to rename the default Apache index.html page.
mv /var/www/index.html /var/www/index.html.orig
You can access the main site by visiting your domain or IP address. So this is how you host a WordPress on your VPS. If you have any question, don’t hesitate to write a comment or tweet me.
Warning : All the link Digital Ocean are reference. I get some free hosting for every user that spend 25$. Also, when you are using you get 10$ of free hosting.