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.sh
This 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:9000
Add domain without SSL (HTTP-only):
sudo ./setup_nginx_reverse_proxy.sh \ --add \ --no-ssl \ --map app.example.com=10.10.0.15:8080
Enable SSL later for an existing domain:
sudo ./setup_nginx_reverse_proxy.sh \ --enable-ssl \ --email ops@example.com \ --domain app.example.com
Disable SSL and switch domain back to HTTP:
sudo ./setup_nginx_reverse_proxy.sh --disable-ssl --domain app.example.com
Disable SSL and also remove certificate:
sudo ./setup_nginx_reverse_proxy.sh --disable-ssl --domain app.example.com --purge-cert
Show proxied domain list and status:
sudo ./setup_nginx_reverse_proxy.sh --list
Show package versions installed/used by the script:
sudo ./setup_nginx_reverse_proxy.sh --versions
Show nginx request statistics (including last 7 days from available logs):
sudo ./setup_nginx_reverse_proxy.sh --stats
Show nginx request statistics for specific domain:
sudo ./setup_nginx_reverse_proxy.sh --stats --domain app.example.com
Disable domain without deleting:
sudo ./setup_nginx_reverse_proxy.sh --disable --domain app.example.com
Enable previously disabled domain:
sudo ./setup_nginx_reverse_proxy.sh --enable --domain app.example.com
Remove domain configuration:
sudo ./setup_nginx_reverse_proxy.sh --remove --domain app.example.com
Remove domain configuration and certificate:
sudo ./setup_nginx_reverse_proxy.sh --remove --domain app.example.com --purge-cert
Notes:
- 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.