nginx Cheatsheet


Setting up a static site in nginx.

Step 1: Create the config file


server {
    listen 443;
    root /path/to/folder/new-site;

Step 2: Symlink the config

# ln -s /etc/nginx/sites-available/new-site.conf /etc/nginx/sites-enabled/

Step 3: Trigger certbot to get SSL certificates

# certbot --nginx

This will add some extra configuration to the nginx file.

Step 4: Restart nginx

# service nginx restart