Skip to content

Instantly share code, notes, and snippets.

@manosriram
Created June 6, 2020 07:55
Show Gist options
  • Save manosriram/2012166f860078131e1d241da92a7f92 to your computer and use it in GitHub Desktop.
Save manosriram/2012166f860078131e1d241da92a7f92 to your computer and use it in GitHub Desktop.
SSL Setup Nginx.
cd ~
sudo apt-get update

wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
apt-get purge python-virtualenv python3-virtualenv virtualenv
pip install virtualenv
mv /.pip/pip.conf /.pip/pip.conf.backup
sudo ./certbot-auto --no-self-upgrade --nginx

sudo ufw status
sudo ufw allow 'Nginx Full'

sudo ./certbot-auto --nginx -d manosriram.xyz -d www.manosriram.xyz
# or
sudo ./certbot-auto --no-self-upgrade --nginx

sudo openssl dhparam -out /etc/ssl/certs/dhparam/pem 2048
sudo vim /etc/nginx/sites-available/<repo_name>

	listen 443 ssl;
	ssl_certificate <path_to_fullchain.pem>
	ssl_certificate_key <path_to_private_key.pem>
	include /etc/letsencrypt/options-ssl-nginx.conf;
	
	ssh_dhparam /etc/ssl/certs/dhparam.pem

sudo nginx -t
sudo systemctl reload nginx
sudo crontab -e (Select 3 for vim)
15 3 * * * /usr/bin/certbot renew --quiet

cd /path/to/your/repo
pm2 restart <id>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment