This script installs Nginx and Certbot, configures a reverse proxy for a given domain and port, and automatically sets up HTTPS with free Let's Encrypt SSL.
- Ubuntu/Debian-based system
sudoprivileges- A domain name pointing to your server's IP
-
Clone this repository
git clone https://github.com/kizhonorium/bash-scripts.git cd bash-scripts -
Make the script executable
chmod +x setup-domain.sh
-
Run the script
./setup-domain.sh <your-domain> <port>
Example:
./setup-domain.sh example.com 9000
- Ensure your domain's DNS A record points to your server before running.
- The script appends a certbot renewal job to root’s crontab:
0 0 * * * /usr/bin/certbot renew --quiet - To manually renew certificates:
sudo certbot renew