Skip to content

✨ Fast and complete NGINX installer

License

Notifications You must be signed in to change notification settings

retouching/nginx-installer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NGINX installer
Fast and complete NGINX installer

Features

  • Mainline or stable version from source
  • Multiples modules and patch available
  • Block NGINX installation using APT to avoid conflicts

Modules and patches available:

And more can be added in the future...

Usage

wget https://raw.githubusercontent.com/retouching/nginx-installer/master/nginx-installer.sh -O nginx-installer.sh
chmod +x nginx-installer.sh
./nginx-installer.sh

You will be able to:

  • Install / Update NGINX
  • Uninstall NGINX with optional cleanup
  • Self-update the script

Headless use

You can run the script without the prompts. This allows for automated install and scripting.

./nginx-installer.sh --headless

Variables can be set in the environment to configure the script.

# Script mode
# 1: install / update nginx
# 2: uninstall nginx
# 3: update script
MODE=1

# Installation variables
# 1: mainline
# 2: stable
NGINX_VERSION=2
# y: install
# n: skip
HEADER_MORE=n
# y: install
# n: skip
SSL_FINGERPRINT=n
# 1: get openssl
# 2: get openssl+quic
# 3: get libressl
OPENSSL=1
# y: install
# n: skip
BROTLI=n
# y: install
# n: skip
TEST_COOKIE=n
# y: install
# n: skip
SUBSTITUTIONS_FILTER=n
# y: install
# n: skip
CACHE_PURGE=n
# y: install
# n: skip
HTTP3=n
# y: install
# n: skip
COOKIE_FLAG=n
# y: install
# n: skip
NAXSI=n
# y: install
# n: skip
TLS_DYN_SIZE=n
# y: install
# n: skip
ZLIB=n
# custom NGINX compile params
NGINX_COMPILATION_PARAMS="
    --prefix=/etc/nginx \
    --sbin-path=/usr/sbin/nginx \
    --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log \
    --http-log-path=/var/log/nginx/access.log \
    --pid-path=/var/run/nginx.pid \
    --lock-path=/var/run/nginx.lock \
    --http-client-body-temp-path=/var/cache/nginx/client_temp \
    --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
    --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
    --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
    --http-scgi-temp-path=/var/cache/nginx/scgi_temp \
    --user=nginx \
    --group=nginx \

    --with-threads \
    --with-poll_module \
    --with-file-aio \
    --with-http_ssl_module \
    --with-http_v2_module \
    --with-http_auth_request_module \
    --with-http_slice_module \
    --with-http_stub_status_module \
    --with-http_realip_module \
    --with-http_sub_module \
    --with-stream_ssl_module \
    --with-debug \
    --with-stream \
    --with-compat
"

# Uninstallation variables
# y: remove configuration
# n: skip
RM_CONF=y
# y: remove logs
# n: skip
RM_LOGS=y

Example of usage:

Install NGINX stable with SSL fingerprint and headers-more-nginx-module

MODE=1 NGINX_VERSION=2 SSL_FINGERPRINT=y HEADER_MORE=y ./nginx-installer.sh --headless

Docker

Docker image available on Docker Hub. Includes all modules with OpenSSL v3.1.5 + QUIC (because this is the only one who have SSL fingerprint and HTTP/3 support).

docker run -d -p 80:5000 -v /my-sites:/etc/nginx/site-enabled retouch1ng/nginx

Credits