After spending a long time on SSH console, Speed testing tools, and web hosting panels; I figured out a server stack that you can use to host a Fast WordPress website. Hosting a WordPress site is not a big task if you know how to get a shared hosting plan from Interserver. But when you want to ultimately control your web server and manage it at your own to host WordPress, you need to know the best stack.
Here’s what I have explained in this tutorial.
- Deploying a Linode cloud server with Ubuntu 18.04 (You can choose any other OS but Ubuntu is best)
- Nginx as webserver
- Php7.4 FPM
- Installation of PhpMyAdmin and accessing it through your domain
- Uploading WordPress using SFTP (Filezilla)
- Setting up Varnish Cache on Nginx
To start with, you can deploy a VPS on Linode for 5$ a month. The configuration of such VPS would be 1v CPU, 1GB RAM, 25GB SSD storage and 1TB bandwidth.
START A 7 DAYS FREE TRIAL NOW
LOGIN as root in putty, terminal or browser SSH terminal.
Start with the commands below.
I have also recorded the whole setup process in above 4 videos.
This will update all the packages on my ubuntu machine.
Nginx server will be installed. Nginx is considered to be better than Apache when it comes to talking about performance; and that too when you run WordPress application only.
MySQL server installation will ask you to use storage on your machine. Give permissions by typing Y and enter.
Next, I will go ahead and setup the SQL server with the command below.
Here, I will skip installing validate password module. Type any letter and enter.
Set a root database password. Type Y whenever it asks.
For this article, I will install PHP 7.4 fpm because it is the latest version and recommended to run WordPress 5.4 on your server.
You will see a line ;cgi.fix_pathinfo=1, if the line is quoted, remove the quote “;” and replace ‘1’ with ‘0’
Start the php7.4 module using the command below
Using the below command, I will edit the default server block in the Nginx configuration.
You have to make sure every rule is not commented out. if the comments are there, just select the whole content on the file and replace with the above content. (after replacing the bold characters with your values)
You can test the server block file for any syntax error using above commands. If the command returns “syntax is OK”, proceed to the next command and reload the Nginx Server.
Now, the server is setup. Lets install PhpMyadmin
Lets link to Phpmyadmin
Do not panic if the above command does not work. Let’s move the next.
Let’s change the phpmyadmin dashboard location. I will simply navigate to my document rule and make a link to the phpmyadmin there.
I have used database only to rename the phpmyadmin link inside the document root, you can use anything to keep it secret.
Open yourdomain/database to verify the install.
So far, we have installed Nginx, PHP 7.4 fpm, MySQL and phpmyadmin on the Ubuntu 18.04.
Now is the time to access your MySQL through SSH and create a database, a new database user, and grant all permissions to that user.
LOGIN to your server as root and enter the MySQL
Enter your MySQL root password and hit enter.
Lets create a database (below are SQL commands)
You should replace the values in bold characters with your own values.
- wordpress – your database name
- wpdbuser – database user’s username
- password – database user password
Now is the time to login to your database through the phpmyadmin console.
I will use FileZilla to upload the WordPress files in the document root directory of the server.
- Edit the wp-config.php
- Archive the whole WordPress
- Rename it to site.zip
- Upload it to /var/www/mydomain
I am back on the SSH terminal now and I will install zip and unzip on the server.
Navigate to the document root and unzip the file here.
Open your browser and hit your domain in the address bar. You should see the WordPress Installation Screen.
Choose the language, Input values, and Run the installation. You should now be able to visit your website on yourdomain.com and sign in to your WordPress.
Let’s set the ownership so that you can install themes and plugins from the WordPress dashboard.
You can host a WordPress site yourself with ease on Linode VPS or any other cloud VPS hosting provider. Please feel free to use comments to ask your questions and request more videos/tutorials.