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: PHPMyAdmin & Redis

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

Installing PHPMyAdmin

Next, we need to install phpmyadmin. The easiest way I have found to do this is to simply clone the phpmyadmin git repository. It makes for easy updating too; you can simply run “git pull origin master” to get the latest version with the required security updates without having to wait for the package within the repositories.

 

Configuring PHPMyAdmin

Now we need to set up some configurations to make PHPMyAdmin a bit faster. These will set up some tables that store settings and allow for encrypted sessions.

First, we copy the sample config to the primary config:

 

Next we need to edit it

 

Set the Blowfish secret line to a random series of characters. This allows for encrypted sessions, and prevents some warning messages. The line should look like:

 

Below that, we need to add a line for the temporary storage directory. This should just be ‘/tmp/’

 

Next, uncomment the server control settings, and set the values. You will also need to create a PHPMyAdmin user (called “pma”) so the phpmyadmin system can access your temporary tables. We will need the pma password later, so keep it handy.

 

Next, uncomment (remove the ‘//’ in front of) all of the $cfg storage and database tables immediately below the control user settings.

Now, we need to create our phpmyadmin database, load it with the SQL settings, and create our pma user. For this, we will need your root password that you used when you set up your MySQL database. Replace the root MySQL password with your own root MySQL password, and replace your pma password with your own pma user password.

 

Finally, set the folder’s permissions and restart the apache service:

 

At this point, if you go to http://[[Your IP Address]]/phpmyadmin , you should be able to see the phpmyadmin account, and log in with your root account and password. When you log in, you shouldn’t see any errors about a “blowfish secret” key, and you should be able to see the “phpmyadmin” table.

If you see an error that the blowfish secret key is too short, add some more characters to the blowfish secret value.

Installing Redis

Now we need to install redis. Redis is as “in-memory data structure store, used as a database, cache and message broker.” In other words, it stores the results of your database queries in memory. This greatly speeds up your website if you’re making the same database calls again and again (such as when using a WordPress site).

 

To check if redis is working, run the following code. If successful, it should return a “PONG”

 

If Redis is working, we need to enable it on startup:

 

Now we need to install and enable the PHP extension for Redis. This will allow us to use Redis directly with PHP, making our sites faster when used.

 

We need to ensure that the /usr/include/php , /usr/lib64/php/build , and /usr/bin/php-config files are all linked up properly. If you’re using PHP7.1, these are the commands I used to link the files.

 

If you are using a different version or configuration, search for “php/build”, or the other files, using:

 

When you have the links set up, run:

 

Next, link the redis.so file to the php/modules/ folder

 

Or, if you aren’t using PHP7.1, you can search for it by running:

 

We also need to create a .ini file for the Redis module. To do this, open the file…

 

… and copy the following into it:

 

Finally, restart Apache:

 

You can check if the php Redis module is loaded by running:

 

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





 


Part 1: Introduction and Planning

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

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