4.8 out of 5
4.8
164 reviews on Udemy

The Perfect Nginx Server – Ubuntu (22.04) Edition

The Absolute Beginners Course to Setting Up Multiple Fast WordPress Sites Using Nginx and Ubuntu 22.04
Instructor:
Andrew Eaton
1,233 students enrolled
English [Auto]
Setup, from scratch, a hardened and optimized VPS or dedicated server
Configure a hardened and optimized hosting environment using Nginx, MariaDB and PHP8.1
Harden WordPress the correct way - installing a security plugin doesn't harden WordPress
Optimize WordPress from the server side - learn how to configure server-side caching, which is far superior to any caching plugin
Learn how to keep your server secure and your WordPress sites hardened from attack by implementing DDoS and brute force attack protection

This course is based on the latest Ubuntu Server Long Term Support Release 22.04

This is a beginner’s course that assumes you have no knowledge configuring a Linux server, server administration or NGINX.

New to Linux or server administration? Included in the course, is an absolute beginners “crash” Linux course. This 1 hour “course within a course” will teach you the commands, terminology and procedures as it relates to this course.

This course is NGINX is a high-performance web server that is responsible for serving almost all of the most popular sites in the world.

We start with a blank slate and layer by layer configure the perfect nginx server.  I will teach you, step by step, to a point where you will have the skill, knowledge and confidence to host multiple hardened WordPress sites, on an unmanaged VPS or dedicated server, using nginx.

You will need no support from your host. You will be your own system administrator.

This course covers the entire spectrum of configuring an Ubuntu based NGINX server. We will cover everything from initial server configuration to hardening and optimizing the server distribution.

Some of the server optimization and hardening steps will include the following topics:

  • SSH Key authentication

  • Setting up both Uncomplicated Firewall and a “Cloud Firewall”

  • Brute force attack protection

  • SWAP

  • Harden Shared Memory

  • Harden and Optimize the Network Layer

  • Tuned and Congestion Control

  • File Access Times and setting the Open File Limits

Then we install, harden and optimize Nginx, MariaDB and php8.1.  Although the default installations of Nginx, MariaDB and PHP8.1 are fairly well hardened, we will spend over 1.5 hours hardening and optimizing Nginx, MariaDB and PHP8.1

Then we install our first WordPress site. We then start the process of hardening and optimizing WordPress. Installing a caching and security plugin does not optimize or harden a WordPress site. Some “security plugins” are a source of vulnerabilities themselves.

Almost 4 hours of the course is dedicated to hardening and optimizing WordPress. We look at hardening and optimizing WordPress from the server side and layer by layer we will harden our site.

Some of the hardening topics include:

  • Installing SSL certificates and configuring automatic renewal of those certificates.

  • Securing the http response headers

  • Setting the correct ownership and permissions on the WP files and directories

  • Using nginx directives to protect important parts of our site

  • Hot linking protection to stop other sites from stealing our bandwidth and driving up server costs

  • Nginx DDoS protection

  • Setting up a web application firewall

When it comes to optimizing WP, we will look at the process from both the server-side and the application (WordPress) side.

On the server-side we will cover the following:

  • optimizing the operating system – prior to optimizing WordPress

  • optimizing nginx – prior to optimizing WordPress

  • configuring php-fpm according to your server resources – prior to optimizing WordPress – set to low your site slows down, set to high and your server will crash

  • server-side caching – fastcgi caching is brilliant

  • replacing WP cron with a real cron

On the application or WordPress side you need to look at the following:

  • Caching plugin – W3 Total Cache

  • Optimizing images

  • Post revisions policy

  • Optimizing the database

  • Combining and minifying CSS and JS

Throughout the course, the principle of install only what’s needed, then harden and optimize is followed. The most important aspect of any server is security. I don’t just glance over this aspect, every configuration step you will take is geared towards security.  We will optimize the server, but not at the expense of lax security.

It’s impossible to list all the hardening and security layers we implement in this section, for a complete list please refer to the actual course curriculum.

By the end of this course, you will be ready to reap the benefits…

You’ll be able to add a new revenue stream and start earning additional income hosting your own sites using NGINX. There will be numerous new services you will be adding to your resume as a web developer. You will be able to charge for numerous new services – site hosting, site optimization, Let’s Encrypt SSL certificate installation and renewal, backups and even a monthly maintenance fee.

This course is not a lab experiment with no real-world application.

This course was not designed to be completed locally, on your pc or mac or using one of the many available “Virtual Machines”. Oracle’s VirtualBox is one example. The aim of the course is to instruct you on how to setup a secure/hardened hosting environment and then host multiple hardened WordPress sites on a commercially purchased VPS or dedicated server.

I want you to able to look at server logs and see how malicious users and bots are scanning your server, probing and looking for vulnerabilities. You need to be able to see the result of your hardening – banning, blocking, rate limiting – in your server logs. This cannot be done in a Virtual Machine.

All that’s left is for you to sign up for this course and start your wonderful journey as your very own systems administrator running multiple WordPress sites using the latest Ubuntu release and NGINX.

Course Introduction

1
Course Introduction

In this section of the course, we are going to look at various introductory topics that relate to this course. It's important that you complete this section of the course as I cover a wide variety of topics and how they relate to the course.

Linux Essential Skills " Crash Course"

1
Introduction

This section of the course is a crash course that covers the linux skills you need to complete this course successfully.

If you are new to linux or server administration, it's important that you watch all the video lectures in the section.

This section covers the commands and processes that you need to know to complete the course.

If you are unsure about any topic covered in this section, please ask for my help on the course Q&A.

I also need to mention that you don’t need access to a server at this stage.

2
Distributions

This lecture covers server distributions

3
Terminal Emulator

This lecture covers the Terminal Emulator

4
Terminal Window

This lecture continues looking at Terminal

5
File System

This lecture covers the Linux File System

6
Users and Groups

This lecture covers Users and Groups on a Linux server

7
Ownership and Permissions

This lecture covers Ownership and Permissions - one of the most misunderstood topics in Linux.

8
Nano & Configuration Files.

This lecture covers using Nano to modify configuration files

9
Server Fingerprint & SSH Key Authentication

This lecture covers the Server Fingerprint and why you replace password authentication with SSH Key Authentication.

10
Bash Scripts, Cron Jobs & Section Conclusion

This lecture covers bash scripts and cronjobs. Bash scripts are used to "automate" procedures and cronjobs are scheduled tasks.

Software

1
Software

In this section we are going to look at the software you require to complete the course successfully. All software used in this course is free and or open source. You will not be required to purchase any software.

Hosts and Servers

1
Web Hosts and Servers

In this section of the course, we are going to cover the following:

  1. server specifications for different types of WordPress sites, by that I'm referring to the resource requirements - for example the number of CPU cores and the RAM

  2. server distributions, that’s the server operating system

  3. my recommended web host

  4. we are also going complete the process of creating an actual server instance for the course

First Server Login as the Administrative "ROOT" User

1
First Login as ROOT - Part 1

In this section we are going to login to the server for the first time and start the server hardening process as the root user.

2
First Login as ROOT - Part 2

In this section we are going to login to the server for the first time and start the server hardening process as the root user.

First Server Login as a "Non Root" User

1
Introduction

In this section we are going to continue the server hardening process as the non-root user

As the non-root user, we will look at using sudo and continue hardening the server by implementing the following measures:

  1. SSH key authentication deals with replacing password usage with a public / private key pair authentication system when logging into your server.

  2. A ssh config file makes logging to a server using ssh key authentication quick and easy

  3. Server updates deal with ensuring all the packages installed on the server are up to date.

  4. Implementing a firewall policy allows you to lock down and close any unused ports and services that are not being used.

  5. Fail2ban is an intrusion prevention framework that will protect your server from brute-force attacks.

2
Using SUDO

The all-powerful administrative account or user on the server is the root user.  Any errors made as the root user are normally irreversible and devastating.

When running commands that require root privileges you must always use the sudo, prior to typing

the command.

3
SSH Key Authentication

SSH key authentication deals with replacing password usage with a public / private key pair authentication system when logging into your server

4
Config File

A ssh config file makes logging to a server using ssh key authentication quick and easy

5
Server Updates

Server updates deal with ensuring all the packages installed on the server are up to date.

6
Firewall

Implementing a firewall policy allows you to lock down and close any unused ports and services that are not being used. We are going to configure both Uncomplicated Firewall and Cloud Firewall

7
Fail2Ban

Fail2ban is an intrusion prevention framework that will protect your server from brute-force attacks

Harden and Optimize the Server Distribution / Operating System

1
Introduction and Setting the Server TimeZone

In this section we are going to further harden the server as well as start to optimize the operating system to help us squeeze every bit of performance we can get out of the server. You cannot tune nginx, mariadb and php for performance and security without first tuning the server operating system for performance and security.

We are going to cover numerous topics in this section.

We'll start with setting the time zone to your local time

2
SWAP

In the event of your server running out of memory, it can make use a ssd space as virtual memory. SWAP is to help prevent your server crashing in the event it runs out of memory.

3
Harden Shared Memory

As the /run/shm space can be exploited we need to secure this space in shared memory.

4
Harden and Optimize the Network Layer

The TCP/IP stack default configuration needs to be hardened against different types of attacks and optimized for performance.

5
Tuned

We are going to install Tuned. Tuned is a profile-based system tuning tool that enables both static and dynamic tuning of system settings

6
Congestion Control

We are going to set the congestion control to BBR - Bottleneck Bandwidth and RTT - Round-trip propagation time - this will help to increase throughput and reduce latency for connections

7
File Access Times

For a performance boost, we are going to disable the filesystem from keeping track of the last time a file was accessed or read

8
Open File Limits

By default, the maximum number of open files allowed per process is set very low. Since sockets are considered files on a Linux system, this limits the number of concurrent connections as well. We need to increase the maximum number of open files allowed per process.

Configuring Cloudflare's Free DNS Service

1
Configuring the DNS

In this section we are going to look at how you point a domain name to your server using Cloudflare.

Installing the L(EMP) Stack: Nginx, MariaDB and PHP8.1

1
Introduction, Repos and APT

In this lecture, we are going to look at repositories, the package manager and we are going to install nginx, mariadb and php.

2
Installing NGINX, MARIADB and PHP8.1

Nginx is the web server, mariadb the database management system and php is the server-side scripting language that is responsible for generating dynamic page content.

Server Mail

1
Configuring the Server to Send Mail without Plugins - Part 1

In this lecture we are going to configure the server to send mail from the command and using php. This will enable your WP site to send mail without using any plugins.

We are also going to look at the easiest method to create a mail@your_domain email account.

2
Configuring the Server to Send Mail without Plugins - Part 2

In this lecture we are going to configure the server to send mail from the command and using php. This will enable your WP site to send mail without using any plugins.

We are also going to look at the easiest method to create a mail@your_domain email account.

Understanding Nginx Configuration Files

1
NGINX Configuration files - Part 1

Before we start configuring nginx, we need to look at the layout of a nginx configuration file as well as definitions that relate to nginx.

We are going to look at directives, contexts, location context modifiers and the try_files directive.

This lecture is important as it teaches you how to read and understand a nginx configuration file.

2
NGINX Configuration files - Part 2

Before we start configuring nginx, we need to look at the layout of a nginx configuration file as well as definitions that relate to nginx.

We are going to look at directives, contexts, location context modifiers and the try_files directive.

This lecture is important as it teaches you how to read and understand a nginx configuration file.

Harden and Optimize Nginx

1
Introduction & the INCLUDE Directive

The default nginx configuration is secure and fairly well optimized. That makes it easy for us to harden and optimize nginx as there are only a few directives we need to modify to further harden and optimize nginx.

There is no all-in-one configuration that works for all sites. You need to configure nginx for the type of sites you intend nginx to serve and in the case of this course, we will be serving WP sites.

In this section we are going to configure the main, events and http contexts. The server context will be looked at later in the course when we create our first server block.

This section is split into 4 parts.

2
The main nginx configuration file - nginx.conf - Part 1

The default nginx configuration is secure and fairly well optimized. That makes it easy for us to harden and optimize nginx as there are only a few directives we need to modify to further harden and optimize nginx.

There is no all-in-one configuration that works for all sites. You need to configure nginx for the type of sites you intend nginx to serve and in the case of this course, we will be serving WP sites.

In this section we are going to configure the main, events and http contexts. The server context will be looked at later in the course when we create our first server block.

This section is split into 4 parts.

3
The main nginx configuration file - nginx.conf - Part 2

The default nginx configuration is secure and fairly well optimized. That makes it easy for us to harden and optimize nginx as there are only a few directives we need to modify to further harden and optimize nginx.

There is no all-in-one configuration that works for all sites. You need to configure nginx for the type of sites you intend nginx to serve and in the case of this course, we will be serving WP sites.

In this section we are going to configure the main, events and http contexts. The server context will be looked at later in the course when we create our first server block.

This section is split into 4 parts.

4
Prevent and Fix the Too Many Open Files Issue

The default nginx configuration is secure and fairly well optimized. That makes it easy for us to harden and optimize nginx as there are only a few directives we need to modify to further harden and optimize nginx.

There is no all-in-one configuration that works for all sites. You need to configure nginx for the type of sites you intend nginx to serve and in the case of this course, we will be serving WP sites.

In this section we are going to configure the main, events and http contexts. The server context will be looked at later in the course when we create our first server block.

This section is split into 4 parts.

5
Bash Aliases

Save time by using bash aliases. This lecture covers how you create a bash aliases.

Harden and Optimize MariaDB

1
Harden MariaDB

In this section we are going to harden and optimize mariadb.

We are also going to install mysqltuner. MySQLTuner is a Perl script that analyzes your MySQL performance and based on the statistics it gathers, gives recommendations which variables you should adjust in order to increase performance.

Using the recommendations, you can tune your database configuration to tweak out the last bit of performance and make it work more efficiently

2
Optimize MariaDB - Part 1

In this section we are going to harden and optimize mariadb.

We are also going to install mysqltuner. MySQLTuner is a Perl script that analyzes your MySQL performance and based on the statistics it gathers, gives recommendations which variables you should adjust in order to increase performance.

Using the recommendations, you can tune your database configuration to tweak out the last bit of performance and make it work more efficiently

3
Optimize MariaDB - Part 2

In this section we are going to harden and optimize mariadb.

We are also going to install mysqltuner. MySQLTuner is a Perl script that analyzes your MySQL performance and based on the statistics it gathers, gives recommendations which variables you should adjust in order to increase performance.

Using the recommendations, you can tune your database configuration to tweak out the last bit of performance and make it work more efficiently

4
MySQLTuner

In this section we are going to harden and optimize mariadb.

We are also going to install mysqltuner. MySQLTuner is a Perl script that analyzes your MySQL performance and based on the statistics it gathers, gives recommendations which variables you should adjust in order to increase performance.

Using the recommendations, you can tune your database configuration to tweak out the last bit of performance and make it work more efficiently

5
Prevent and Fix the Too Many Open Files Issue

In this section we are going to harden and optimize mariadb.

We are also going to install mysqltuner. MySQLTuner is a Perl script that analyzes your MySQL performance and based on the statistics it gathers, gives recommendations which variables you should adjust in order to increase performance.

Using the recommendations, you can tune your database configuration to tweak out the last bit of performance and make it work more efficiently

Harden and Optimize PHP8.1

1
Harden PHP 8.1

In this section we are going to harden and optimize php8.1

2
Optimize PHP 8.1

In this section we are going to harden and optimize php8.1

3
Prevent and Fix the Too Many Open Files Issue

In this section we are going to harden and optimize php8.1

Server and Site File and Directory Structure

1
File and Directory Structure

In this lecture we are going to create the directories that are going to store our WP files and directories.

We are also going to create a bash script to "automate" the process of creating site directories.

Nginx Server Blocks

1
NGINX Server Blocks - Part 1

Nginx Server Blocks allow you to host and serve more than one site on your server.

Some of the configuration that is included in a server block:

  1. port nginx must listen

  2. the domain name

  3. site root - where the files are located

  4. the index page nginx must serve

If you have used Apache before, the server context or server block is the equivalent of a virtual host. For each site you intend to host, you need to create a server block for that site.

You will learn how to create a nginx server block from scratch.

This section is divided into 4 lectures.

2
NGINX Server Blocks - Part 2

Nginx Server Blocks allow you to host and serve more than one site on your server.

Some of the configuration that is included in a server block:

  1. port nginx must listen

  2. the domain name

  3. site root - where the files are located

  4. the index page nginx must serve

If you have used Apache before, the server context or server block is the equivalent of a virtual host. For each site you intend to host, you need to create a server block for that site.

You will learn how to create a nginx server block from scratch.

This section is divided into 4 lectures.

3
NGINX Server Blocks - Part 3

Nginx Server Blocks allow you to host and serve more than one site on your server.

Some of the configuration that is included in a server block:

  1. port nginx must listen

  2. the domain name

  3. site root - where the files are located

  4. the index page nginx must serve

If you have used Apache before, the server context or server block is the equivalent of a virtual host. For each site you intend to host, you need to create a server block for that site.

You will learn how to create a nginx server block from scratch.

This section is divided into 4 lectures.

4
NGINX Server Blocks - Part 4

Nginx Server Blocks allow you to host and serve more than one site on your server.

Some of the configuration that is included in a server block:

  1. port nginx must listen

  2. the domain name

  3. site root - where the files are located

  4. the index page nginx must serve

If you have used Apache before, the server context or server block is the equivalent of a virtual host. For each site you intend to host, you need to create a server block for that site.

You will learn how to create a nginx server block from scratch.

This section is divided into 4 lectures.

Installing WordPress

1
Database Administration

In this section we are going to install our first WordPress site. We are going to start by creating the database.

We are going to use MariaDB as out database management system. All things being equal, MariaDB is faster than MySQL and whenever possible I always support and prefer to use an open-source project.

2
Installing WordPress - Part 1

In this lecture you are going to install your first WordPress site, this lecture is divided into 2 parts.

3
Installing WordPress - Part 2

In this lecture you are going to install your first WordPress site, this lecture is divided into 2 parts.

Harden WordPress

1
Introduction

This is a relatively long section covering many different topics.

I cannot emphasize how important it is to harden your WordPress site.

The topics include:

2
SSL - Installing SSL Certificates

Installing SSL certificates, configuring nginx to use the ssl certificates and configuring automatic renewal of the certificates

3
SSL - NGINX HTTPS Configuration

Installing SSL certificates, configuring nginx to use the ssl certificates and configuring automatic renewal of the certificates

4
SSL - NGINX Secure Server Blocks

Installing SSL certificates, configuring nginx to use the ssl certificates and configuring automatic renewal of the certificates

5
SSL - HTTPS Everywhere

Installing SSL certificates, configuring nginx to use the ssl certificates and configuring automatic renewal of the certificates

6
SSL - Certbot Commands

Installing SSL certificates, configuring nginx to use the ssl certificates and configuring automatic renewal of the certificates

7
HTTP Response Headers

Securing the http response headers

8
Ownership & Permissions Part 1

Setting the correct ownership and permissions on the WP files and directories

9
Ownership & Permissions Part 2

Setting the correct ownership and permissions on the WP files and directories

10
Ownership & Permissions Part 3

Setting the correct ownership and permissions on the WP files and directories

11
Using NGINX Directives to Harden Your WordPress Site

Use nginx directives to protect important parts of our site

12
Stop Brute Force Attacks Using Nginx

Stop brute force attacks using nginx directives

13
Hot Linking Protection

Stop other sites from stealing our bandwidth and driving up server costs

14
Nginx DDoS Protection

Protect your server and sites from small DDoS attacks using nginx.

15
Web Application Firewall

Finally, we are also going to look at a WAF, a web application firewall.

Optimize WordPress

1
Introduction to WordPress Optimization

In this section we are going to optimize WordPress, configure php-fpm and CF. After the hardening WordPress Section, this is the longest section of the course. Take your time and work your way through each sub-section one at a time.

2
Server Side Optimization

When it comes to optimizing WP, you need to look at the process from both the server-side and the application (WordPress) side.

On the server-side you need to look at the following:

  • optimizing the operating system

  • optimizing nginx

  • configuring php-fpm according to your server resources

  • server-side caching

  • setting the WP max memory

  • replacing WP cron with a real cron

3
Application (WordPress) Side Optimization

When it comes to optimizing WP, you need to look at the process from both the server-side and the application (WordPress) side.

On the application or WP side you need to look at the following:

  • Caching plugins

  • Optimizing images

  • Your sites post revisions policy

  • Optimizing the database

  • Combining and minifying CSS and JS

4
Caching WordPress

A fast WordPress site is a cached WordPress site

5
Static & Dynamic WP Sites

Different types of WordPress sites need to be cached differently. In this lecture we look at the different types of WordPress sites and how to cache those sites.

6
Implementing a Caching Policy - Introduction - Part 1

The type of caching you need to implement depends on your site, is your site a static or dynamic WP site

7
Implementing a Caching Policy - FastCGI Caching - Part 2

Nginx fastcgi caching is brilliant. The performance is absolutely stunning. This lecture is divided into 3 parts

8
Implementing a Caching Policy - FastCGI Caching - Part 3

Nginx fastcgi caching is brilliant. The performance is absolutely stunning. This lecture is divided into 3 parts

You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
4.8
4.8 out of 5
164 Ratings

Detailed Rating

Stars 5
137
Stars 4
22
Stars 3
1
Stars 2
1
Stars 1
1