-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
105 lines (87 loc) · 2.36 KB
/
nginx.conf
File metadata and controls
105 lines (87 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Code Health Monitor - Nginx 配置
# 提供静态报告文件访问
server {
listen 80;
server_name localhost;
# 字符编码
charset utf-8;
# 根目录
root /usr/share/nginx/html;
index index.html;
# 访问日志
access_log /var/log/nginx/code-health-access.log;
error_log /var/log/nginx/code-health-error.log;
# 首页 - 重定向到报告中心
location = / {
return 302 /reports/index.html;
}
# Dashboard
location /dashboard/ {
alias /usr/share/nginx/html/dashboard/;
try_files $uri $uri/ /dashboard/index.html;
}
# 报告目录
location /reports/ {
alias /usr/share/nginx/html/reports/;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
# 支持中文文件名
charset utf-8;
# 缓存策略
expires 1h;
add_header Cache-Control "public, max-age=3600";
}
# 日报 - 目录访问重定向到报告中心
location = /reports/daily/ {
return 302 $scheme://$http_host/reports/index.html;
}
location /reports/daily/ {
alias /usr/share/nginx/html/reports/daily/;
autoindex off;
}
# 周报 - 目录访问重定向到报告中心
location = /reports/weekly/ {
return 302 $scheme://$http_host/reports/index.html;
}
location /reports/weekly/ {
alias /usr/share/nginx/html/reports/weekly/;
autoindex off;
}
# 月报 - 目录访问重定向到报告中心
location = /reports/monthly/ {
return 302 $scheme://$http_host/reports/index.html;
}
location /reports/monthly/ {
alias /usr/share/nginx/html/reports/monthly/;
autoindex off;
}
# Markdown 文件直接显示
location ~* \.md$ {
default_type text/plain;
charset utf-8;
}
# HTML 文件
location ~* \.html$ {
default_type text/html;
charset utf-8;
}
# 健康检查
location /health {
access_log off;
return 200 "OK\n";
add_header Content-Type text/plain;
}
# 禁止访问隐藏文件
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# 错误页面
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}