angristan / nginx-autoinstall

Compile NGINX from source with custom modules and patches on Debian and Ubuntu
GNU General Public License v3.0
636 stars 237 forks source link
alpn brotli chacha20-poly1305 cloudflare curve25519 debian geoip http2 libressl nginx openssl pagespeed waf

nginx-autoinstall

Compile and install NGINX from source with optional features, modules and patches.

Compatibility

The script might work on ARM-based architectures, but it's only being regularly tested against x86_64 with GitHub Actions.

Features

Optional modules/features

Cache Modules

Usage

Just download and execute the script :

wget https://raw.githubusercontent.com/angristan/nginx-autoinstall/master/nginx-autoinstall.sh
chmod +x nginx-autoinstall.sh
./nginx-autoinstall.sh

You will be able to:

Just follow the question!

You can check configuration examples for the custom modules.

Headless use

You can run the script without the prompts with the option HEADLESS set to y. This allows for automated install and scripting. This is what is used to test the script with GitHub Actions.

HEADLESS=y ./nginx-autoinstall.sh

To install Nginx mainline with Brotli:

HEADLESS=y \
NGINX_VER=MAINLINE \
BROTLI=y \
./nginx-autoinstall.sh

To install with Geoip:

HEADLESS=y \
GEOIP=y \
GEOIP2_ACCOUNT_ID=YOUR_ACCOUNT_ID_HERE \
GEOIP2_LICENSE_KEY=YOUR_LICENSE_KEY_HERE \
./nginx-autoinstall.sh

To uninstall Nginx and remove the logs and configuration files:

HEADLESS=y \
OPTION=2 \
RM_CONF=y \
RM_LOGS=y \
./nginx-autoinstall.sh

All the default variables are set at the beginning of the script.

LICENSE

GPL v3.0