Files
MyBlog/nginx.conf
T
2026-05-11 15:51:32 +08:00

50 lines
991 B
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_comp_level 6;
gzip_proxied any;
gzip_types
application/javascript
application/json
application/rss+xml
application/xml
image/svg+xml
text/css
text/javascript
text/plain
text/xml;
location ~* \.(?:css|js|mjs|woff2?|ttf|otf|eot|ico|png|jpg|jpeg|gif|webp|avif|svg)$ {
try_files $uri =404;
access_log off;
add_header Cache-Control "public, max-age=31536000, immutable";
}
location ~* \.html$ {
try_files $uri =404;
add_header Cache-Control "no-cache";
}
location = /robots.txt {
try_files $uri =404;
add_header Cache-Control "public, max-age=3600";
}
location = /sitemap.xml {
try_files $uri =404;
add_header Cache-Control "public, max-age=3600";
}
location / {
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache";
}
}