Compile and install NGINX from source with optional features, modules and patches.
- Debian 8 and later
- Ubuntu 16.04 and later
The script might work on ARM-based architectures, but it's only being regularly tested against x86_64 with GitHub Actions.
- Latest mainline or stable version, from source
- Optional modules and patches
- Custom nginx.conf (default does not work)
- Init script for systemd (not provided by default)
- Logrotate conf (not provided by default)
- Block Nginx installation from APT using pinning, to prevent conflicts
- LibreSSL from source (CHACHA20, ALPN for HTTP/2, X25519, P-521)
- OpenSSL from source (TLS 1.3, CHACHA20, ALPN for HTTP/2, X25519, P-521)
- Cloudflare's patch for HTTP/3 with Quiche and BoringSSL. (
⚠️ the patch doesn't work for versions > 1.19.6.) - Cloudflare's TLS Dynamic Record Resizing patch maintained by nginx-modules.
- Cloudflare's HTTP/2 HPACK encoding patch (original patch, fixed patch)
- ngx_pagespeed: Google performance module
- ngx_brotli: Brotli compression algorithm
- ngx_headers_more: Custom HTTP headers
- ngx_http_geoip2_module with libmaxminddb and GeoLite2 databases
⚠️ currently broken, see #128 - ngx_cache_purge: Purge content from FastCGI, proxy, SCGI and uWSGI caches
- ngx-fancyindex : fancy file listings
- nginx-dav-ext-module: WebDAV PROPFIND, OPTIONS, LOCK, UNLOCK support)
- nginx-module-vts: Nginx virtual host traffic status module (install instructions)
- ModSecurity-nginx: connector for the ModSecurity open-source web application firewall (WAF)
- testcookie-nginx-module: simple robot mitigation module using cookie based challenge/response (example config)
- lua-nginx-module: extend NGINX with Lua. Using luajit2 (OpenResty's maintained branch of LuaJIT) and ngx_devel_kit (Nginx Development Kit (NDK))
- nginx_substitutions_filter: regular expression and fixed string substitutions for nginx
- RTMP module (NGINX-based Media Streaming Server)
- nginx-ultimate-bad-bot-blocker: Bad Bot and User-Agent Blocker, Spam Referrer Blocker, Anti DDOS, Bad IP Blocker and Wordpress Theme Detector Blocker
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:
- Install NGINX
- Update NGINX (It will install it again and overwrite current files and/or modules.)
- Uninstall NGINX with optional cleanup
- Self-update the script
Just follow the question!
You can check configuration examples for the custom modules.
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 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.
GPL v3.0