Skip to content

Commit

Permalink
use expires directive and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sainak committed Sep 24, 2024
1 parent d2853e5 commit bfb90a8
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
server {

listen 80;
root /usr/share/nginx/html;
error_page 500 502 503 504 /50x.html;

# Location block for index.html with a 6-hour cache
location = /index.html {
root /usr/share/nginx/html;
add_header Cache-Control "public, max-age=21600, must-revalidate";
try_files $uri $uri/ /index.html;
expires 6h;
}

# Location block for all other files with a 7-day cache
location / {
root /usr/share/nginx/html;
index index.html index.htm;
expires 7d;
try_files $uri $uri/ /index.html;
add_header Cache-Control "public, max-age=604800, must-revalidate";
}


error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}
}
}

0 comments on commit bfb90a8

Please sign in to comment.