Load Times Under 2s: Installing Nginx
May 6, 2018 | By David Selden-Treiman | Filed in: hosting.Next up we need to compile and install nginx. We can’t simply run the yum command because we’re going to need to add some modules to the Nginx program. This will help speed things up when serving web pages to visitors.
First we need to install the pcre library. We are going to have to download, compile, and install it ourselves. The pcre library is used by the engine X core and the rewrite modules to provide support for regular expressions. You’re going to want to download the most recent version. As of writing this that’s version 8.41.
Then extract it, configure it, make it, and install it.
Next up or going to need the zlib library. This is required by inch next for the GSAT module and provides compression functionality. You’re going to want to download the most recent version, as of writing this that is version 1.2.11.
Then extract it, configure it, make it, and install it.
Now we need the openssl libraries. This will provide SSL encryption to our nginx server. Again download the most recent openssl version, as of writing this that’s version 1.1.1.
Then extract it, configure it, make it, and install it.
With all of those libraries belt we can finally download and configure nginx with our modules. Replace the “nginx-*” with the folder name in your downloaded source.
You can feel free to add or remove modules as needed. A full list of the available modules can be found here: https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/ .
If everything configured properly, you can make, and install Nginx.
We need to also create a user for the Nginx process.
… and a cache folder
At this point and Nginx should be fully compiled and installed. Now we’re going to test it. We’re going to run it, check if the processes running, and then and the process if it is working. So first start the process:
Next, find the process id of the Nginx server.
And if it shows up and is working, end the process.
Now we need to create a service daemon for the process so we can start, stop, and enable Nginx on-startup. When you install a program from scratch, this isn’t created automatically, so we need to make it ourselves. Create the nginx.service file
… and copy and paste the following code into it
Now, reload the daemons
Next we need to create the initialization script for Nginx. Open the file
… and copy in the script
Now, make the script executable
Enable the Nginx process
Check that it’s enabled properly
Restart the process
And check that it’s working.
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.
- 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.
David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.
- Part 2: Installing Software
Initial setup of the server, including installing CentOS7, installing tools, installing SSH and SSL, enabling repositories, and installing support packages.
David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.
- Part 3: MySQL, Apache, PHP7, & Composer
Installation of MySQL database server, Apache web server, PHP, and Composer package manager for PHP
David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.
- Part 4: PHPMyAdmin & Redis
How to download, install, and configure PHPMyAdmin; How to install and configure Redis
David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.
- Part 5: SSL Certificate & Apache Configuration
David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.
- Part 6: FTP & DNS
David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.
- Part 7: Installing Nginx
David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.
- Part 8: Configuring Nginx
How to set up Nginx configuration files including (with explanations): nginx.conf, Gzip compression settings, visitor browser caching settings, SSL settings, reverse proxy settings for sending data to the Apache server, reverse proxy connection configurations, file access restrictions, and WordPress configuration settings
David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.
- 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.
David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.
- Part 10: WordPress Website Speed Improvements
Speeding up your WordPress installation using a Redis plugin and a caching plugin.
David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.
David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.
Comments are closed here.