I wrote a script while back that automates the download, compilation, and installation of NGINX + NAXSI + ngx_pagespeed for Ubuntu & Debian based servers. It also supports upgrading - you only have to change the variables if there is an update for NGINX.
The reason why you want to compile NGINX manually is to be able to add modules, and customize compilation argument to customize NGINX the way you want it to be. This script simplifies that into just a single command (two if you are downloading via wget...). I am planning to create an option where it automatically configures NGINX for Flarum (and other popular applications), but I will maybe get into that in the near future.
Download
To download the script, either head to link to Github below, or just wget it.
wget https://github.com/simdol/nginx-naxsi-pagespeed/blob/master/nnp.sh
Running the Script
All you have to do is change few variables inside the script, and run it with...
sudo chmod +x nnp.sh && sudo bash nnp.sh
More Information...
NGINX should be installed on /usr/local/nginx. Note that when you compile NGINX, it is not automatically added to the PATH. If you want to add it to PATH or into init.d, look it up.
If you didn't add it to PATH or did not create custom init.d script, you must run it manually with...
'sudo /usr/local/nginx/sbin/nginx'
To stop it,
'sudo /usr/local/nginx/sbin/nginx -s quit'
If you want to learn more, head to https://www.nginx.com/resources/wiki/ for more information.