How To Set Up A WordPress Site On A VPS In Under 5 Minutes

In this tutorial, we will use a Vultr VPS to set up a wordpress website in under 5 minutes.

Thereafter, we will point our domain name to the VPS and ensure that we have a fully functional website.

Why Vultr VPS?

The reason we have chosen Vultr is because it is one of the cheapest VPS providers.

At the lowest level, Vultr offers a VPS with 25GB SSD, 1 CPU, 1024MB Memory and 1000 GB Bandwidth for only $5 per month or $0.007 per hour.

These offerings are very generous for the price and are more than sufficient (with proper caching) to handle a website with about 10,000 visitors per day.

Also, Vultr has servers in four continents being America, Europe, Australia and Asia.

Within each continent, there are various locations such as in Asia, there are severs in Tokyo and Singapore.

The best part is that the servers are blazing fast.

The VPS is responsive and the pages of the website load very fast.

Deploy new instance – choose WordPress

Under the ‘Deploy New Instance’ tab, choose ‘Cloud Compute’.

Select a ‘Sever Location’ of your choice.

Wordpress Deploy Servers - Vultr com

Under ‘Server Type’, choose ‘Application’ and thereafter choose ‘WordPress’.

Under ‘Server Size’, choose the cheapest server of 25GB SSD at a cost of $5 per month.

Add a ‘Server Hostname & Label’ of your choice.

Now, hit the ‘Deploy Now’ button to start the process of creation of the server with WordPress pre-installed.

Activate wordpress

Within a few seconds, the server gets installed.

Thereafter, clicking the ‘Server Details’ tab shows the details of the server and its IP Address, username, password etc.

Continue WordPress Installation

To complete the WordPress installation, you will have to follow these instructions.

1. Go to http://Server-IP-Address/wp-admin/

There is HTTP authentication which will require the username and password.

You can access the WP admin panel using the following credentials:

Username: As given

Password: As given

This will give you access to the installation and you can continue by choosing the language, admin name, password, e-mail etc.

Point domain to the IP Address

Now, the most important aspect is to point the domain name at the name registrar to the IP Address and to the WordPress website.

This is accomplished with the following steps:

(i) Go to the name registrar (such as namecheap or godaddy) and change the ‘A Record’ to point to the IP Address.

Wordpress VPS site in 5 minutes

(ii) Go to WordPress Admin > Settings > General and enter the domain name in the boxes for “WordPress Address (URL)” and “Site Address (URL)”.

Wordpress Webiste On Vultr VPS

Thereafter, when the domain propogates across the internet, you will be able to access your WordPress website through the domain name.

Change root password

Login to your server with putty using the username as ‘root’ and the password as given by Vultr in the email.

Use the command ‘passwd’ to change the password.

Change default HTTP Auth username and password

The HTTP Auth is used to protect the wp-admin files.

We have to first determine which file has the credentials for the HTTP Auth.

We can see this by opening the configuration file with the command:

nano /etc/nginx/conf.d/wordpress_http.conf

This block deals with the HTTP Auth

location ^~ /wp-admin/ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd/wpadmin;

location ~* \.(htaccess|htpasswd) {
deny all;
}

location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass php-handler-http;
fastcgi_read_timeout 60s;
}
}

The file which has the HTTP credentials is

 /etc/nginx/htpasswd/wpadmin 

We create a backup of the wpadmin file with the command

 mv /etc/nginx/htpasswd/wpadmin /etc/nginx/htpasswd/wpadmin-BU 

Now, we create a fresh wpadmin file with the username and password of our choice

 htpasswd -c /etc/nginx/htpasswd/wpadmin newuser 

This will prompt for the password

Save the file and restart the web server with the command:

 systemctl restart nginx.service && systemctl restart php7.2-fpm.service 

(PHP version may vary)

Now, we should be able to access the HTTP Auth with the username and password of our choice

Remove HTTP Auth and wp-admin login prompt

To remove the wp-admin login prompt do the following:

(i) Login to the server using ssh as root.

(ii) Create a backup of the vhost files with the command:

 cp /etc/nginx/conf.d/*.conf /root/ 

(iii) Edit the two vhost files in /etc/nginx/conf.d/.

Remove the block of code that starts with location ^~ /wp-admin/.

It reads as follows:

location ^~ /wp-admin/ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd/wpadmin;

location ~* \.(htaccess|htpasswd) {
deny all;
}

location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass php-handler-http;
fastcgi_read_timeout 60s;
}
} 

(iv) Save the file and restart the web server with the command:

 systemctl restart nginx.service && systemctl restart php7.2-fpm.service 

(PHP version may vary)

Conclusion

With this, we now have a fully functional wordpress website on a Vultr VPS in the shortest possible time.

DON’T MISS! Free VPS | Selection Of Best Offers In Linux & Windows

Leave a Reply

Your email address will not be published. Required fields are marked *