Update Production HTTPS Setup

Linden Crandall 2025-02-11 00:49:10 +00:00
parent 45c07bc40a
commit fb7e101112

@ -109,12 +109,7 @@ cp https/nginx/secondary_automatisch_letsencrypt_nginx.conf https/nginx/automati
- Replace <HOSTNAME> entries again with the DNS and save before continuing: - Replace <HOSTNAME> entries again with the DNS and save before continuing:
``` ```
# nginx conf file to use after LetsEncrypt SSL certs have been created
# replace <HOSTNAME> with your DNS i.e.automatisch.lasthourhosting.org
server { server {
# nginx http port # nginx http port
listen 80; listen 80;
listen [::]:80; listen [::]:80;
@ -123,35 +118,40 @@ server {
location ~ /.well-known/acme-challenge/ { location ~ /.well-known/acme-challenge/ {
root /var/www/certbot; root /var/www/certbot;
} }
return 301 https://$host$request_uri; return 301 https://$host$request_uri;
} }
server { server {
# nginx https port # nginx https port
listen 443 ssl http2; listen 443 ssl;
listen [::]:443 ssl http2; listen [::]:443 ssl;
http2 on;
# use ssl letsencrypt certs # use ssl letsencrypt certs
ssl_certificate /etc/letsencrypt/live/<HOSTNAME>/fullchain.pem; ssl_certificate /etc/letsencrypt/live/<HOSTNAME>/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/<HOSTNAME>/privkey.pem; ssl_certificate_key /etc/letsencrypt/live/<HOSTNAME>/privkey.pem;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1h;
server_name <HOSTNAME>; server_name <HOSTNAME>;
location / { location / {
# Forward to Automatisch site which is running on port 7757 # Forward to Automatisch site which is running on port 7757
proxy_pass http://main:7757/; proxy_pass http://main:7757/;
proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-Proto https;
} }
location ~ /.well-known/acme-challenge/ { location ~ /.well-known/acme-challenge/ {
root /var/www/certbot; root /var/www/certbot;
} }
} }
``` ```
- Then rebuild the containers: `docker compose up -d`. After it is rebuilt we should be able to pull up Automatisch at the DNS with a valid SSL cert bound to it - Then rebuild the containers: `docker compose up -d`. After it is rebuilt we should be able to pull up Automatisch at the DNS with a valid SSL cert bound to it