Nginx Server Blocks allow me to host multiple sites on one web server.

Because I use the LinuxServer.io image for Nginx, this procedure is non-standard (they moved all config and all web roots to /config) but this is how it works with my configuration…

  ~/docker/webserver
      config
          www
              augmentech
              livetime
              labblog
              privocative
              tikishack
              (etc.)
          nginx
              site-confs

In site-confs, files are created such as privocative.com.conf, livetime.com.conf, etc. Each of these files needs to be named after the site - whether it's tikishack.com or augmentech.donferris.me AND it needs to end with “.conf”.

The file contents look like this:

  server {
      listen 80;
      server_name privocative.com www.privocative.com;
      root /config/www/privocative;
      access_log /var/log/nginx/privocative.com-access.log;
      error_log /var/log/nginx/privocative.com-error.log;
  }

The root line needs to point toward the correct directory for the content of that site. Once the [website].conf file has been created, the webserver container needs to be restarted.