-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf.example
More file actions
69 lines (58 loc) · 1.99 KB
/
nginx.conf.example
File metadata and controls
69 lines (58 loc) · 1.99 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
# Nginx configuration for Check4Fail status page
# Place this in /etc/nginx/sites-available/status.example.com
# Then: ln -s /etc/nginx/sites-available/status.example.com /etc/nginx/sites-enabled/
# Reload: nginx -t && systemctl reload nginx
server {
listen 80;
listen [::]:80;
server_name status.example.com;
# Redirect HTTP to HTTPS (optional, recommended)
# return 301 https://$server_name$request_uri;
root /path/to/check4fail/public_html;
index index.html;
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
# Prevent caching of HTML status pages (fixes Chrome auto-refresh issues)
location ~* \.html$ {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
}
# Cache static assets
location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg)$ {
expires 1h;
add_header Cache-Control "public, immutable";
}
# Main location
location / {
try_files $uri $uri/ =404;
}
# Deny access to hidden files
location ~ /\. {
deny all;
}
access_log /var/log/nginx/status.example.com.access.log;
error_log /var/log/nginx/status.example.com.error.log;
}
# HTTPS configuration (optional, requires SSL certificate)
# server {
# listen 443 ssl http2;
# listen [::]:443 ssl http2;
#
# server_name status.example.com;
#
# ssl_certificate /etc/letsencrypt/live/status.example.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/status.example.com/privkey.pem;
# ssl_protocols TLSv1.2 TLSv1.3;
# ssl_ciphers HIGH:!aNULL:!MD5;
#
# root /path/to/check4fail/public_html;
# index index.html;
#
# # Same configuration as above
# location / {
# try_files $uri $uri/ =404;
# }
# }