server { listen 80; server_name contact.boilerhaus.org; # Redirect HTTP to HTTPS location / { return 301 https://$host$request_uri; } } server { listen 443 ssl http2; server_name contact.boilerhaus.org; # SSL Configuration (make sure to update paths to your certificates) ssl_certificate /etc/letsencrypt/live/boilerhaus.org/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/boilerhaus.org/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/boilerhaus.org/chain.pem; ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_session_tickets off; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384'; ssl_prefer_server_ciphers on; # HSTS add_header Strict-Transport-Security "max-age=63072000" always; # Security Headers add_header X-Content-Type-Options nosniff; add_header X-Frame-Options SAMEORIGIN; add_header X-XSS-Protection "1; mode=block"; # Logs access_log /var/log/nginx/contact.boilerhaus.org.access.log; error_log /var/log/nginx/contact.boilerhaus.org.error.log; # Proxy to Node.js application location / { proxy_pass http://localhost:3001; # Assuming your Next.js app will run on port 3001 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_cache_bypass $http_upgrade; } # Serve static files directly location /_next/static { alias /path/to/your/app/.next/static; expires 365d; access_log off; } # Serve public files directly location /public { alias /path/to/your/app/public; expires 365d; access_log off; } }