30 lines
827 B
Plaintext
30 lines
827 B
Plaintext
# node-frontend-vue2 站点:Tengine 3.1.0 托管 Vue 2 构建产物(纯静态,无后端依赖)
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
access_log /dev/stdout main;
|
|
|
|
root /usr/local/nginx/html;
|
|
index index.html;
|
|
|
|
# 静态资源带 hash,长缓存;index.html 每次重新验证,保证发版后立即生效
|
|
location /assets/ {
|
|
expires 30d;
|
|
add_header Cache-Control "public, immutable";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# 前端路由兜底:hash 模式下用不到,保留是为了以后切 history 模式时不用改配置
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# 健康检查:直接读 index.html
|
|
location = /healthz {
|
|
access_log off;
|
|
default_type text/plain;
|
|
return 200 "ok\n";
|
|
}
|
|
}
|