Sometimes you may need more than the defaults provide you.
That’s why I build Nginx from source, and why you might need or want to do that at some point too.
What are the benefits?
Obviously you wouldn’t want to do it if it didn’t give you some benefits.
Some possible improvements that you might get from building it yourself include:
Modules that aren’t included by default
Better compression methods
Ways to hide the headers that indicate that you’re running Nginx
Nicer autoindexing
Removing modules you don’t actually need.
Newer version of OpenSSL (TLS1.3 support)
External bits
To build nginx, some preparations were necessary.
I’m going to be using /usr/local/src for storing all of the source code.
You’ll want to grab the latest versions for:
openssl
zlib
pcre
If you want to download any nginx modules, also download them. I used:
More headers module
Brotli compression module
Fancy index module
Building it
First we need to prepare the things for building. Remember to add the dependencies to the config options. And I’m going to be building nginx to replace the system package, but if you don’t want that, change the paths as well in the following config: