30 lines
834 B
Plaintext
30 lines
834 B
Plaintext
# node-frontend-react-class 站点:Tengine 3.1.0 托管 React 构建产物(纯静态,无后端依赖)
|
|
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;
|
|
}
|
|
|
|
# 前端路由兜底:示例不引入路由库,保留是为了以后加 react-router 时不用改配置
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# 健康检查:直接读 index.html
|
|
location = /healthz {
|
|
access_log off;
|
|
default_type text/plain;
|
|
return 200 "ok\n";
|
|
}
|
|
}
|