Adding a static website

This section describes the steps for adding websites, following these references:

Nginx Multisite - Documentation

Generating SSL Keys - Let's Encrypt - Documentation

  1. Create a directory for the website HTML content.
    mkdir -p /usr/share/nginx/html/newsite.com

  2. Add default index.html

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Site 1</title> </head> <body> <h1>Helo vino</h1> </body> </html>
  3. Change to /etc/nginx

  4. Create sites-available and sites-enabled

    mkdir /etc/nginx/sites-enabled mkdir /etc/nginx/sites-available
  5. Add sites-enabled support, by adding this line after (include /etc/nginx/conf.d/*.conf;)

    include /etc/nginx/sites-enabled/*.conf;
  6. Comment out the default server section

  7. Restart the webserver

  8. Create the website configuration file (sites-available/newsite.com.conf)

  9. Activate the site

  10. Test everything and restart

  11. Add an SSL certificate with certbot

  12. Remove the section that causes loops