-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
46 lines (40 loc) 路 907 Bytes
/
Copy pathnginx.conf
File metadata and controls
46 lines (40 loc) 路 907 Bytes
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
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Compression (Lighthouse: enable text compression)
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
gzip_min_length 256;
gzip_types
application/javascript
application/json
application/xml
image/svg+xml
text/css
text/javascript
text/plain
text/xml;
# Transfer optimizations
sendfile on;
tcp_nopush on;
tcp_nodelay on;
# Serve static assets with cache headers
location ~* \.(?:css|js|jpg|jpeg|gif|png|svg|ico|webp|woff|woff2|ttf|eot)$ {
try_files $uri =404;
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
}
# Unknown routes: serve the static 404 page
location / {
try_files $uri $uri.html $uri/ /404.html;
}
# Optional: Deny access to hidden files
location ~ /\. {
deny all;
}
}