Skip to content

nginx - program cheatsheet


$ apt-get update
$ sudo apt-get install certbot
$ apt-get install python-certbot-nginx


generate dhparams

sudo mkdir /etc/nginx/ssl
sudo openssl dhparam -out /etc/nginx/ssl/dhparam-2048.pem 2048
sudo openssl dhparam -out /etc/nginx/ssl/dhparam-4096.pem 4096
* will take several minutes

control nginx

sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl status nginx

test nginx configuration

sudo nginx -t
sudo nano /etc/nginx/sites-available/$DOMAIN_NAME
sudo ln -s /etc/nginx/sites-available/$DOMAIN_NAME /etc/nginx/sites-enabled/$DOMAIN_NAME

obtain a certificate

let certbot obtain a certificate for us and apply the default nginx SSL configuration like follows: -->

sudo certbot --rsa-key-size 4096 --nginx -d $DOMAIN_NAME

pay attention

when using lets encrypt, be sure to read the output.

 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.

Back to top