Created
January 10, 2025 22:43
-
-
Save mdestafadilah/fdb7326171aea55db0fb546337329428 to your computer and use it in GitHub Desktop.
nginx-file-access
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ~* \.(jpg|jpeg|gif|png|bmp|ico|flv|swf|js|css|ttf|woff|woff2) { | |
add_header Cache-Control public; | |
add_header Cache-Control must-revalidate; | |
expires 7d; | |
} | |
location ^~ /public/ { | |
deny all; | |
} | |
location /images/ { | |
access_log off; | |
expires max; | |
location ~ "\.(png|jpg|ttf|woff|woff2|pdf)$" { | |
allow all; # allow images, etc. | |
} | |
location ~ "/$" { | |
allow all; | |
autoindex off; # allow listing directory contents | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment