Files
quality_analyse/deploy/aliyun/quality-center.conf

73 lines
2.1 KiB
Plaintext

# Nginx site for the locally hosted Quality Center API and static frontend.
# Install only after the TLS certificate for quality.lyunlab.me exists.
server {
listen 80;
server_name quality.lyunlab.me;
location ^~ /.well-known/acme-challenge/ {
root /var/www/letsencrypt;
try_files $uri =404;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name quality.lyunlab.me;
ssl_certificate /etc/letsencrypt/live/quality.lyunlab.me/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/quality.lyunlab.me/privkey.pem;
root /srv/quality-center/current;
index index.html;
client_max_body_size 260m;
access_log off;
error_log /var/log/nginx/quality-center.error.log warn;
add_header X-Content-Type-Options nosniff always;
add_header Referrer-Policy strict-origin-when-cross-origin always;
# This bridge is reserved for the local NAO runtime, not remote browsers.
location = /api/analysis/runtime/query {
return 404;
}
# Health details are not part of the public frontend contract.
location ^~ /actuator/ {
return 404;
}
location ^~ /api/ {
proxy_pass http://127.0.0.1:15281;
proxy_http_version 1.1;
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 Connection "";
proxy_connect_timeout 5s;
proxy_send_timeout 900s;
proxy_read_timeout 900s;
proxy_buffering off;
proxy_request_buffering off;
proxy_cookie_flags JSESSIONID secure;
proxy_cookie_flags XSRF-TOKEN secure samesite=strict;
}
# 静态文本压缩只在站点根目录启用;API 的 SSE 代理缓冲仍保持关闭。
location / {
gzip on;
gzip_min_length 1024;
gzip_vary on;
gzip_types text/plain text/css application/javascript application/json image/svg+xml application/xml;
try_files $uri $uri/ /index.html;
}
}