Automated Nginx installation and reverse proxy configuration toolkit. Provides Bash scripts and templates to quickly deploy, manage, and maintain proxied websites with support for SSL and multiple upstream services.
Bootstrap server (default mode, no parameters):
sudo ./setup_nginx_reverse_proxy.shThis mode:
- Installs only missing packages (
nginx,certbot,python3-certbot-nginx,curl). - Verifies that server has public IPv4.
- Enables
certbot.timerfor auto-renewal.
Add or update proxied domains:
sudo ./setup_nginx_reverse_proxy.sh \
--add \
--email ops@example.com \
--map app.example.com=10.10.0.15:8080 \
--map api.example.com=10.10.0.16:9000Add domain without SSL (HTTP-only):
sudo ./setup_nginx_reverse_proxy.sh \
--add \
--no-ssl \
--map app.example.com=10.10.0.15:8080Enable SSL later for an existing domain:
sudo ./setup_nginx_reverse_proxy.sh \
--enable-ssl \
--email ops@example.com \
--domain app.example.comDisable SSL and switch domain back to HTTP:
sudo ./setup_nginx_reverse_proxy.sh --disable-ssl --domain app.example.comDisable SSL and also remove certificate:
sudo ./setup_nginx_reverse_proxy.sh --disable-ssl --domain app.example.com --purge-certShow proxied domain list and status:
sudo ./setup_nginx_reverse_proxy.sh --listShow package versions installed/used by the script:
sudo ./setup_nginx_reverse_proxy.sh --versionsShow nginx request statistics (including last 7 days from available logs):
sudo ./setup_nginx_reverse_proxy.sh --statsShow nginx request statistics for specific domain:
sudo ./setup_nginx_reverse_proxy.sh --stats --domain app.example.comDisable domain without deleting:
sudo ./setup_nginx_reverse_proxy.sh --disable --domain app.example.comEnable previously disabled domain:
sudo ./setup_nginx_reverse_proxy.sh --enable --domain app.example.comRemove domain configuration:
sudo ./setup_nginx_reverse_proxy.sh --remove --domain app.example.comRemove domain configuration and certificate:
sudo ./setup_nginx_reverse_proxy.sh --remove --domain app.example.com --purge-certNotes:
- Free SSL certificates are issued via Let's Encrypt.
- Auto-renewal is enabled with
certbot.timer. - DNS A records for configured domains must point to this server public IP (unless
--skip-dns-checkis used). - Weekly request statistics depend on retained files in
/var/log/nginx(logrotate retention). - Domain-specific stats use
/var/log/nginx/<domain>.access.log*for domains managed by this script.