Files
001code-html--cocos/docker-conf/conf.d/nginx.conf
刘宇飞 6e0a1fbcbb Initial commit of 001code-html Scratch frontend project.
Includes scratch-gui, scratch-vm, scratch-blocks, scratch-render, scratch-l10n, and deployment config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-16 15:37:45 +08:00

70 lines
1.8 KiB
Nginx Configuration File

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;
}
# Brotli 压缩 WebAssembly 文件处理
location ~* \.wasm\.br$ {
default_type "";
add_header Content-Encoding br;
add_header Content-Type application/wasm always;
add_header Vary Accept-Encoding;
expires 30d;
}
location ~* \.asm\.js\.br$ {
default_type "";
add_header Content-Encoding br;
add_header Content-Type application/javascript always;
add_header Vary Accept-Encoding;
expires 30d;
}
# 通用 Brotli 文件处理
location ~* \.br$ {
add_header Content-Encoding br;
add_header Vary Accept-Encoding;
expires 30d;
}
# 静态资源缓存配置
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;
}