Hi All,I'm ruing NGINX + Apache and trying to get leverage browser caching working.
Somehow the guides I found just don't do what they are supposed to doCould anyone explain me a bit?
Regards!
Yesterday, 08:21 AM #1
Hi All,I'm ruing NGINX + Apache and trying to get leverage browser caching working.
Somehow the guides I found just don't do what they are supposed to doCould anyone explain me a bit?
Regards!
Yesterday, 05:07 PM #2
Do you need it to be in nginx or can you use apache since you are ruing nginx + apache? I use mine in a .htaccess file.Code:
# Time cheat sheet in seconds # A86400 = 1 day # A172800 = 2 days # A2419200 = 1 month # A4838400 = 2 months # A29030400 = 1 year # Remove the ETag (entity tag) response header field # This is most likely the optimum choice to use. Header unset ETag FileETag none <IfModule mod_expires.c> ExpiresActive on # ExpiresByType overrides the ExpiresDefault... # cache expiration time of 2 days|A172800. ExpiresDefault A172800 ExpiresByType image/jpg A4838400 ExpiresByType image/jpeg A4838400 ExpiresByType image/gif A4838400 ExpiresByType image/png A4838400 ExpiresByType image/bmp A4838400 ExpiresByType image/x-icon A4838400 ExpiresByType image/svg+xml A4838400 ExpiresByType text/javascript A4838400 ExpiresByType text/x-javascript A4838400 ExpiresByType text/css A4838400 ExpiresByType text/html A4838400 ExpiresByType application/x-font-ttf A4838400 ExpiresByType application/x-font-woff A4838400 ExpiresByType font/opentype A4838400 ExpiresByType application/x-shockwave-flash A4838400 ExpiresByType application/x-javascript A4838400 ExpiresByType application/javascript A4838400 ExpiresByType video/mp4 A4838400 ExpiresByType video/ogg A4838400 ExpiresByType video/webm A4838400 </IfModule> <IfModule mod_headers.c> <FilesMatch ".(js|css|flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|gif|jpg|jpeg|png|swf|webm)$"> Header append Cache-Control "public" </FilesMatch> <FilesMatch ".(txt|html)$"> Header append Cache-Control "proxy-revalidate" </FilesMatch> <FilesMatch ".(php|cgi|pl|htm|xml)$"> Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform" Header set Pragma "no-cache" </FilesMatch> </IfModule> <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css text/javascript AddOutputFilterByType DEFLATE application/javascript application/x-javascript AddOutputFilterByType DEFLATE application/x-httpd-php application/x-httpd-fastphp AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/xml-dtd AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf AddOutputFilterByType DEFLATE image/svg+xml # Drop problematic browsers BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch bMSI[E] !no-gzip !gzip-only-text/html # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary </IfModule>
Yesterday, 11:08 PM #3
Hello,NGINX does not support .htaccess and Apache's mod_expires instructions.
Check this: https://nginx.ru/en/docs/http/ngx_ht...rs_module.html
With regards, Alex.✔ Professional Server Management for web hosting companies and individuals
✔ Hourly Support, Disaster Recovery, Server Hardening, Monthly Subscription
✔ Directadmin installation and optimizationClick here if you need a Linux Admin
Yesterday, 11:50 PM #4
Can you please explain a little more ? What I am using passes all browser cache tests I have found.Is it the mod_headers part ?
I'm confused !
برچسب:
نویسنده: ایمان اصلاحی