Nginx And The LEMP Stack
December 31st, 2017
Vice President of Content in Content
This video course will serve as an introduction to the Nginx Web Server and will help point out key differences between Nginx and Apache. Our exploration will serve both as a setup exercise as well as a detailed configuration guide. We will deploy and setup Nginx Web Server from scratch and then conceptually build a fully functional LEMP server as we learn each new directive and configuration topic.
Introduction and Installation
This collection of videos will introduce Nginx as a web server, highlighting the key differences between it and its more popular cousin, Apache HTTP Server. We will then download, install and set up the Nginx agent for autostart on reboot and finally test our newly installed web server.
This video will introduce the Nginx web server and delineate how it is different in architecture, configuration and style from its more popular cousin, Apache HTTP Server.
Installation and Basic Setup Tour
This video will demonstrate how to add the appropriate repository to CentOS and then the process as it applies to almost any distribution for the initial installation and service start of Nginx. Finally, we will take a brief tour of the important file and directory locations for the server.
VHosts and Directives
We will dive into the configuration of our web server deeper by changing the initial installation setup to more closely match the more commonly known and understand layouts in CentOS and Ubuntu distributions. We will talk about how to configure VHosts to answer for domains, how to use the Upstream directive for load balancing as well as proxying and naming common configuration collections.
We will take our basic installation and setup from earlier in our series, and make some adjustments that make sense in a server environment. We will talk about how to make the configuration directories more familiar to those used to managing Apache without compromising what makes Nginx great. We will then test and restart our server to be sure we are ready to proceed.
Now we begin to dive into the deep end. Much like Apache, we will show how to allow our web server to answer for various domains by configuring them in Vhost files (Virtual Hosts). We will talk about the default method in the nginx.conf file, but then move to the more common externalization of those files and how to set them up to answer for our configured domains and file system locations.
Now that we have our Vhost configurations set up for basic domain management, we will learn about how the Upstream directive in our Vhosts can allow us to do port redirection. We will add a server configuration name and then reference it within our server configuration. NOTE: Source for simple HTTP server used in this video can be obtained from here: http://www.sitepoint.com/creating-a-http-server-in-node-js/
Basic Load Balancing
Our Upstream directive showed us how to manage server resources by name and port, now we will use that directive to manage multiple nodes. This will allow Nginx to proxy connections to multiple back ends and then balance the load amongst them using weighting to determine which servers get the most connections.
SSL Certificate Management
Up to now, we have been listening to incoming connections over standard, unsecured HTTP. In this video, we will talk about securing our traffic over HTTPS and demonstrate how to generate our server key, the certificate signing request (for exchange with a third party for a valid certificate) and how to self sign a certificate for non-production or test environments. Finally, we will add that functionality to our configured Vhost domain and test that the connection shows as secured.
In this video we will explore the Location directive. We will talk about its purpose, how it differentiates a location from the root directive and customizing it to give us flexibility in traffic management and page requests.
Within our web configuration, we have the ability to specifically indicate how Nginx should respond to certain page or path requests. In this video, we will demonstrate how to use the return directive to customize how our server responds to certain requests.
Although we could spend a full course of videos on how to do regular expression matching, this video will introduce you to the ability to use said regular expressions to rewrite paths or results automatically in your configuration. We will talk about how it works and the format to use in your rewrite statement.
Custom Error Pages
Like almost everything else in our Nginx configuration, we can take full control over how our web server responds to pages and requests. This video will show how to replace the built in error pages (like 403, 404, 50x) with custom error pages that can be built to match your domain and branding.
We will explore some of the more advanced and customized logging directives and formats that are available through Nginx.
This video will introduce the viewer to the myriad of logging directives available globally as well as how to override those by domain and/or by service in our vhost configurations.
Custom Log Levels
Now that we know how to set global and domain/service log file locations, we will talk about performance (buffering) and log levels for our error reporting and what each level means.
Custom Access Log Format
We have control over the details of many aspects of our Nginx web server, including how access logs are written and in what format. In this video we will demonstrate how to create multiple log_formats that we can use in various situations and how to use them to write only the information useful to us.
In this section, we will discuss various security concerns and configuration settings for our Nginx web server.
Although we can talk about how to Block IPs at a firewall level (whether it is a hardware firewall device or a software level firewall on our system), sometimes we want to allow the connections and have more granular control over how and why we block them. We will set up a basic set of ACLs at a Web Server and then domain level and how each one works.
These videos will walk through the Linux Nginx MariaDB and PHP configuration that make up the LEMP stack, similar to its more commonly known brethren, the LAMP Stack. We will then test our setup and configuration by installing and demonstrating the PHPMyAdmin application for database management and configuration.
LEMP Stack: Configuration Optimization
This video will talk about how to optimize our setup so we can configure our new LEMP stack Web, PHP and MariaDB system.
LEMP Stack: PHP
This video will leverage our Nginx setup and install and configure PHP and the necessary PHP-FPM module for use in our Web/DB/PHP environment.
LEMP Stack: MariaDB
This video will leverage our Nginx setup and install and configure MariaDB (the drop in MySQL replacement DB) and the necessary secure setup for use in our Web/DB/PHP environment.
We will summarize the Nginx course that we have been progressing for and make a last case for the use of this technology.
We will try to wrap up the course and discuss all the use cases for Nginx in general.