Files
one-pipe-h5/docker/nginx.conf
huang 43dfc0f9e0
Some checks failed
构建并部署 H5 前端 / build-and-deploy (push) Has been cancelled
自动部署
2026-01-22 17:16:16 +08:00

42 lines
995 B
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 80;
server_name localhost;
# gzip 压缩
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
# 静态资源目录
root /usr/share/nginx/html;
index index.html;
# 健康检查端点
location /health {
access_log off;
return 200 'ok';
add_header Content-Type text/plain;
}
# 静态资源缓存JS/CSS/图片)
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
}
# Vue Router history 模式支持
location / {
try_files $uri $uri/ /index.html;
}
# 禁止访问隐藏文件
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}