Watch the video:
0:00 - Intro/Explanation
0:15 - Updating system
0:44 - Adding Nginx Mainline ppa
1:20 - Installing Nginx Mainline
1:37 - Verify Nginx Mainline is installed
1:55 - Enable Nginx as service
Why change how we install Nginx?
Installing Nginx from the normal app repository can result in outdated versions of Nginx being installed. This guide will be using Ubuntu, a Debian-based distro. Commands should work for both Ubuntu and other Debian-based distros.
For example:
|
|
To see which versions of Nginx are available from the apt database. I see:
|
|
Installling Nginx using sudo apt update && sudo apt install nginx
would install 1.18. This sounds great, but you can install and use Nginx 1.27. Installing with the normal command would install a much older version. 1.18 lost support 3 years ago (20 Apr 2021)
This is not good.
What is better?
The best way to install Nginx is to follow the official install instructions. This should result in the latest Nginx Mainline being installed.
However, there’s an even better way. If you’re a serious about compression and other things you will likely want to use Brotli compression. This is not available without going through another installation process (it can be done for free, officially).
We can use other users’s install scripts or distributions. A fantastic repo I’d recommend using is Ondřej Surý’s Nginx PPA on launchpad.net. More info.
This comes with Brotli pre-installed!
Let’s do it!
Installing Nginx with Brotli
|
|
Just like that you now have Nginx installed and ready to use! And best of all you can set up Brotli with just a few lines in your configuration files.