77 lines
2.4 KiB
Plaintext
77 lines
2.4 KiB
Plaintext
#----------------------------------------------------------------------
|
|
# MATRIX + ELEMENT (isolated certs, does NOT touch shared current.crt)
|
|
# Rendered by bootstrap/edge terraform. Keep this file idempotent:
|
|
# it regenerates identically on every apply.
|
|
#----------------------------------------------------------------------
|
|
|
|
# --- ACME + HTTP redirect for matrix / element ---
|
|
server {
|
|
listen 80;
|
|
server_name ${matrix_server_name} ${element_server_name};
|
|
|
|
location ^~ /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
default_type "text/plain";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
# --- matrix server_name — Synapse client-server API ---
|
|
server {
|
|
listen 443 ssl;
|
|
http2 on;
|
|
server_name ${matrix_server_name};
|
|
|
|
ssl_certificate ${matrix_cert_dir}/matrix.crt;
|
|
ssl_certificate_key ${matrix_cert_dir}/matrix.key;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
ssl_session_cache shared:matrix_ssl:10m;
|
|
ssl_session_timeout 1d;
|
|
|
|
location / {
|
|
proxy_pass http://${matrix_backend_host}:${matrix_backend_port};
|
|
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 https;
|
|
proxy_read_timeout 90s;
|
|
}
|
|
|
|
location /.well-known/matrix {
|
|
proxy_pass http://${matrix_backend_host}:${matrix_backend_port}/.well-known/matrix;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
}
|
|
}
|
|
|
|
# --- element server_name — Element web UI ---
|
|
server {
|
|
listen 443 ssl;
|
|
http2 on;
|
|
server_name ${element_server_name};
|
|
|
|
ssl_certificate ${matrix_cert_dir}/matrix.crt;
|
|
ssl_certificate_key ${matrix_cert_dir}/matrix.key;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
|
ssl_session_cache shared:matrix_ssl:10m;
|
|
ssl_session_timeout 1d;
|
|
|
|
location / {
|
|
proxy_pass http://${element_backend_host}:${element_backend_port};
|
|
proxy_http_version 1.1;
|
|
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 https;
|
|
}
|
|
}
|