52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
# Replace every chat.example.com with your actual domain before installing.
|
|
# Install only after the certificate and .baiyue-preview.htpasswd exist.
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name chat.example.com;
|
|
|
|
location ^~ /.well-known/acme-challenge/ {
|
|
root /var/www/letsencrypt;
|
|
try_files $uri =404;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name chat.example.com;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/chat.example.com/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/chat.example.com/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
|
|
# Guard all pages, API routes, attachments and history/export operations.
|
|
auth_basic "Baiyue private acceptance";
|
|
auth_basic_user_file /etc/nginx/.baiyue-preview.htpasswd;
|
|
|
|
# Allow multipart overhead around the application's 10 MiB file limit.
|
|
client_max_body_size 12m;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:5000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header Authorization "";
|
|
|
|
# SSE must reach the browser as chunks arrive.
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
gzip off;
|
|
proxy_read_timeout 300s;
|
|
proxy_send_timeout 300s;
|
|
}
|
|
}
|