Static File Serving with Caching
1 min read
- Authors
- Name
- Vijaykumar Rajendran
- @vijayrajendran_

Table of Contents
Static File Serving
Production Config
server {
root /var/www/static;
location / {
try_files $uri =404;
}
# Cache assets 1 year
location ~* \.(js|css|png|jpg|svg)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Compress
gzip on;
gzip_types text/css application/javascript;
}
Blazing fast!