Skip to content

Instantly share code, notes, and snippets.

@wesort
Last active September 20, 2022 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wesort/afcdfe24cb5b7783927c5e9b5e31d5c2 to your computer and use it in GitHub Desktop.
Save wesort/afcdfe24cb5b7783927c5e9b5e31d5c2 to your computer and use it in GitHub Desktop.
nginx.conf adjustments for Statamic deployed to Digitalocean using Laravel Forge
# Replace location / {...} with this:
location / {
try_files /static${uri}_${args}.html $uri /index.php?$args;
}
# Add to bottom just before closing `}`:
# Enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
gzip_vary on;
# Expire headers on static assets
# CSS and Javascript
# Media: images, icons, video, audio, HTC
location ~* \.(?:css|js|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|eot|ttf|woff|woff2)$ {
try_files $uri /index.php?$query_string;
expires 1y;
access_log off;
add_header Cache-Control "public";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment