56 lines
2.0 KiB
Plaintext
56 lines
2.0 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;
|
|
|
|
# Staff and unknown routes remain protected; guest APIs check their own visitor owner.
|
|
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;
|
|
|
|
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 "";
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
gzip off;
|
|
proxy_read_timeout 300s;
|
|
proxy_send_timeout 300s;
|
|
|
|
location = / { auth_basic off; proxy_pass http://127.0.0.1:5000; }
|
|
location ^~ /static/ { auth_basic off; proxy_pass http://127.0.0.1:5000; }
|
|
location ^~ /uploads/ { auth_basic off; proxy_pass http://127.0.0.1:5000; }
|
|
location ~ ^/(?:healthz|stream_chat|api/(?:visitor/(?:session|human/(?:request|poll|send|close))|customer/(?:session|login|logout)|new_chat|get_history|get_messages|del_history|clear_all|upload|ticket|rate|feedback|speech/(?:config|transcribe)))$ {
|
|
auth_basic off;
|
|
proxy_pass http://127.0.0.1:5000;
|
|
}
|
|
location / { proxy_pass http://127.0.0.1:5000; }
|
|
}
|