Files
wizardchen 84eb205a27 fix(nginx): change server listen port from 80 to 8081
Update the Nginx configuration to listen on port 8081 instead of the default port 80. This change is necessary for serving the documentation site correctly in the current deployment setup.
2026-08-06 21:59:01 +08:00

46 lines
1.4 KiB
Nginx Configuration File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server {
listen 8081;
server_name localhost;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css text/javascript application/javascript application/json
application/xml application/rss+xml image/svg+xml font/ttf font/otf;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
error_log /var/log/nginx/error.log warn;
access_log /var/log/nginx/access.log;
# 独立容器时根路径重定向到文档前缀;经网关反代 /docs/ 时通常不会命中。
location = / {
return 302 /docs/;
}
# VitePress base=/docs/:磁盘上是 dist/assets/...URL 为 /docs/assets/...
location /docs {
alias /usr/share/nginx/html/;
index index.html;
try_files $uri $uri/ $uri.html /docs/index.html;
add_header Cache-Control "no-cache, must-revalidate" always;
}
location ^~ /docs/assets/ {
alias /usr/share/nginx/html/assets/;
add_header Cache-Control "public, max-age=31536000, immutable" always;
}
error_page 404 /docs/404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}