How to setup cheap VPS to preform very fast with Wordpress
I'm sure many of you are aware how quickly a website loads is a ranking factor for SEO. I don't think it is heavily weighted, but the fact of the matter is you can easily lose traffic because your site is taking too long to load. If you're doing PPC then you MUST MUST MUST have a quick loading website.
Now, I'm no expert in the field, but I thought I would give a quick tutorial encase someone needed help. Shared hosting plans are bad. VPS is better, but managed can be quite costly $50+/monthly. Instead we will use an unmanaged VPS to host wordpress. Using this setup I have a site that loads under 1 second for $5/month
Step 1:
Let's get a VPS - linode.com The $5/month plan will be fine. Note: Select a linode that is closest to where your users live, that will help with website load speeds.
Step 2:
Check THIS guide
Step 3:
Now we install the LAMP Stack
Before you begin any installation, make sure that your software is up to date:
sudo apt-get update
Install Apache:
sudo apt-get install apache2
Set Apache to start on server boot:
sudo update-rc.d apache2 defaults
Install MySQL
Install the mysql-server package and choose a secure password when prompted:
sudo apt-get install mysql-server
Create a MySQL Database
Log into MySQL:
mysql -u root -p
Enter MySQL’s root password, and you’ll be presented with a MySQL prompt (most likely skip).
If no password was entered in the previous section, or if you want to change the root password, enter the following command.
Replace password with a new root password:
ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'password';
Create a database and a user with permissions for it. In this example, the database is called webdata, the user webuser, and password password:
CREATE DATABASE webdata;
GRANT ALL ON webdata.* TO 'webuser' IDENTIFIED BY 'password';
Exit MySQL:
quit
PHP 7.0
Install PHP, the PHP Extension and Application Repository, Apache support, and MySQL support:
sudo apt-get install php7.0 php-pear libapache2-mod-php7.0 php7.0-mysql
Optionally, install additional cURL, JSON, and CGI support:
sudo apt-get install php7.0-curl php7.0-json php7.0-cgi
Create the log directory for PHP and give ownership to the Apache system user:
sudo mkdir /var/log/php
sudo chown www-data /var/log/php
Restart Apache:
sudo systemctl restart apache2
Step 4: Configure Virtual Apache Host
Create the virtual directories for your domain:
sudo mkdir -p /var/www/coolexample.com/public_html
Change the ownership to the Apache group:
sudo chown -R www-data:www-data /var/www/coolexample.com/public_html
This lets Apache modify files in your web directories.
Change the directory's permissions so its files can be read from the internet:
sudo chmod -R 755 /var/www/coolexample.com/public_html
Create Virtual Host File:
For the virtual host configuration file, we're going to copy Apache's default config file called 000-default.conf from the sites-available directory as a template.
Copy the 000-default.conf file:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/coolexample.com.conf
Open your newly copied config file:
sudo vim /etc/apache2/sites-available/coolexample.com.conf
In the file, find DocumentRoot towards the beginning of the file, and update with your own domain:
DocumentRoot /var/www/coolexample.com/public_html
Below DocumentRoot, add these two lines:
ServerName http://www.coolexample.com
ServerAlias coolexample.com
Save and close the file:
Press ESC then :wq!
Enable your virtual host:
sudo a2ensite coolexample.com.conf
Restart Apache:
sudo service apache2 restart
Log into where you bought your domain and point your domain name to your server. On Namecheap go to
Domain List > Manage > Advanced DNS > Add new record
Type:NS Host:www Value: ns1.linode.com value auto
Type:NS Host:www Value: ns2.linode.com value auto
Type:NS Host:www Value: ns3.linode.com value auto
Type:NS Host:www Value: ns4.linode.com value auto
Step 5:
Check THIS guide
Note:
Once you have your wordpress set up you can use Amazon AWS - S3 to host your images. A CDN will help with the load time of your website.