Load balancer_NGINX configuration - SomethingWithHorizons/mailserver GitHub Wiki

  1. Create new directories within /var/www where certbot (letsencrypt) can temporarily place the challenge/validation files:

    mkdir -p /var/www/letsencrypt/.well-known
    chown -R www-data:www-data /var/www/letsencrypt
  2. Add a new /etc/nginx/letsencrypt file to handle letsencrypt requests:

    cat <<EOT >> /etc/nginx/letsencrypt
    location ^~ /.well-known {
        default_type "text/plain";
        root /var/www/letsencrypt;
    }
    EOT
  3. Open /etc/nginx/nginx.conf and add the following block within the http { ... } section:

    server {
        listen 80 default_server;
        server_name _;
    
        location / {
            root /usr/share/nginx/html;
            index index.html index.htm;
        }
    
        include letsencrypt;
    }
⚠️ **GitHub.com Fallback** ⚠️