Give us a call: (800) 252-6164
Select your language
How to make your website load in under 2 seconds using Apache, Nginx, Redis, PHP7, MySQL, and WordPress

Load Times Under 2s: Installing Software

May 6, 2018 | By PotentPages | Filed in: hosting.

The Hardware

For this tutorial, you will need a CentOS 7 server. You can get these through different means, either setting up your own or purchasing a virtual private server. Personally I’m using a self-managed GoDaddy four core virtual private server at the moment. What you should get will depend on your individual needs. Whichever you get, you need it to be a bare install, not a partially managed solution with a bunch of software (like WHM pre-installed.)

Running All Setup Commands as Super User

While doing this installation you will need to use Superuser for all installations. To do this simply type in the terminal:

Your IP Address (If you don’t already know it)

First off we need to ascertain your IP address and your networking information. To do this simply run the command:

 
Make note of the interface, for example “eth0”, and make sure it’s not “lo” or a local address like “127.0.0.1”. In my case, it was the last one in the list. We’ll need this in a bit.

Install Some Tools

Next we will install some tools. For text editor we will be using Nano although Vi will work perfectly well. We will also install some monitoring tools specifically iotop, iftop and strace. This allow you to monitor the disk usage the network usage and trace program activity, respectively.

 

Auto-Start Networking

If you’re running a physical server you’re going to want to make sure that your networking is enabled by default. On some CentOS installations networking isn’t enabled by default. So run the following command, or replace the “eth0” with the interface that you see when you ran “ip addr”.

 

Next, ensure that

 

is present in your file. This sets your network interface to automatically start when your computer starts up.

SSH and SSL

Next we need to install SSH and SSL. To do this run the following command:

 
If you’re building this within a virtual-box or another non-remote machine, at this point you should be able to ssh into your server from your main desktop and simply copy and paste a lot of these instructions in.

Enable Repositories

We will need to enable the EPEL repositories for some packages.

 

However we will need to downgrade one package. IP utils doesn’t work out of the box and the current version is broken to downgrade it run the following command:

 

Then you need to add “exclude=iputils” to “[base]” section of /etc/yum.repos.d/CentOS-Base.repo to prevent the broken version from being automatically reinstalled.

 

Add in

 
Mine looks like:

 

Install Support Packages

Now we need to install some support packages.

 

These are mainly for compiling which we will need later on however some of them aren’t essential right now such as the git packages. Nevertheless they prove useful so I recommend installing them.

 

Set Your Hostname

We will need to set your hostname to a value that’s easy to use. We will need that value later. So keep note of it. Replace “[Your Hostname]” with a value (no spaces or special characters). This is like the “name” of your server.

 

Now you need to edit your hosts file and set your localhost to your server name.

 

You will need to add

to the file near the top.

 

Automatic Installation?

If you like the result of the tutorial, but run into problems or would just like to have the work done automatically, we can help you with that. We have an automated script that can SSH into your server and run this tutorial from beginning to end (as long as it’s running CentOS 7). If you would like this done for you ($100), please contact us using the form below.

 

Get Started





 


Why it’s important to have your pages load in under 2 seconds, and a plan of how we will set up and configure the server.

Part 2: Installing Software

Initial setup of the server, including installing CentOS7, installing tools, installing SSH and SSL, enabling repositories, and installing support packages.

Installation of MySQL database serverApache web serverPHP, and Composer package manager for PHP

Part 4: PHPMyAdmin & Redis

How to download, install, and configure PHPMyAdmin; How to install and configure Redis

Part 5: SSL Certificate & Apache Configuration

How to create a self-signed SSL certificate; how to configure Apache as a PHP backend

Part 6: FTP & DNS

How to install and configure an FTP server with dynamic users; how to set up a DNS server

Part 7: Installing Nginx

How to download, build, and install Nginx with additional modules

Part 8: Configuring Nginx

How to set up Nginx configuration files including (with explanations): nginx.confGzip compression settingsvisitor browser caching settingsSSL settingsreverse proxy settings for sending data to the Apache serverreverse proxy connection configurationsfile access restrictions, and WordPress configuration settings

Part 9: Adding a WordPress Website

How to add a WordPress website to the server including configuring the DNS Server, adding a verified SSL certificate, either manually or for free using Let’s Encrypt, setting up FTP for your site, configuring Apache, configuring Nginx, uploading your WordPress site files, and importing your MySQL database.

Part 10: WordPress Website Speed Improvements

Speeding up your WordPress installation using a Redis plugin and a caching plugin.



Tags:

Comments are closed here.

Scroll To Top