This commit is contained in:
Evan
2026-09-07 09:55:36 +08:00
parent 9b6892f2ed
commit badbc11154
9098 changed files with 985321 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
server {
listen 80;
server_name localhost;
index index.html index.htm default.htm default.html;
root /usr/share/nginx/html;
# gzip 配置
gzip on;
gzip_min_length 1k;
gzip_comp_level 6;
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
# 重定向规则
location = /c/scssn2025 {
return 301 /competition.html?competition_id=13;
}
# Unity 预压缩文件:禁止再次 gzip避免 Content-Length 与实际内容不一致
location ~* \.wasm\.br$ {
gzip off;
default_type application/wasm;
add_header Content-Encoding br;
add_header Content-Type application/wasm always;
add_header Vary Accept-Encoding;
add_header Accept-Ranges bytes;
expires 1h;
}
location ~* \.js\.br$ {
gzip off;
default_type application/javascript;
add_header Content-Encoding br;
add_header Content-Type application/javascript always;
add_header Vary Accept-Encoding;
add_header Accept-Ranges bytes;
expires 1h;
}
location ~* \.data\.br$ {
gzip off;
default_type application/octet-stream;
add_header Content-Encoding br;
add_header Vary Accept-Encoding;
add_header Accept-Ranges bytes;
expires 1h;
}
# 通用 Brotli 文件处理
location ~* \.br$ {
gzip off;
add_header Content-Encoding br;
add_header Vary Accept-Encoding;
add_header Accept-Ranges bytes;
expires 1h;
}
# 静态资源缓存配置
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
error_log off;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 12h;
error_log off;
access_log off;
}
location / {
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache, no-store";
}
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md) {
return 404;
}
# 错误日志和访问日志配置
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
}