nginx equivalent for ExpiresByType / FilesMatch

ST smntov at gmail.com
Mon Jun 12 13:36:27 UTC 2017


Hello,

I continue to move my configuration from Apache to nginx and now need to
convert following directives. Any hints?

Thank you for all the previous help!

1. 

<IfModule mod_expires.c>
# set up max-age header directive for certain file types for proper
caching
ExpiresActive on
ExpiresByType text/css A604800
ExpiresByType text/js  A604800
...


2.

# force download for ceratain file types
<FilesMatch "\.(?i:fb2|mobi|mp3)$">
   Header set Content-Disposition attachment
</FilesMatch>
<FilesMatch "\.(?:fb2)$>
   Header set Content-type text/fb2+xml
</FilesMatch>

3.
Order Allow,Deny
Allow from All

# block certain files
<Files dirs.inc>
   Order Allow,Deny
   Deny from All
</Files>




More information about the nginx mailing list