2015-10-29 8 views
0

Как я могу очистить кеш Apache на удаленном сервере, запущен ubuntu 14.04lts?Очистить собственный кеш Apache

Моя проблема:

Получение файла CSS от myurl.com/myfile.css получает меня старый файл. Фактически я изменил содержимое этого файла.

После этого я изменил мой файл .htacces отключить кэширование:

<ifmodule mod_expires.c> 
    ExpiresActive On 
    ExpiresDefault "access plus 1 seconds" 
    ExpiresByType text/html "access plus 7200 seconds" 
    ExpiresByType image/gif "access plus 518400 seconds" 
# ExpiresByType image/jpeg "access plus 518400 seconds" 
# ExpiresByType image/png "access plus 518400 seconds" 
# ExpiresByType text/css "access plus 518400 seconds" 
    ExpiresByType text/javascript "access plus 216000 seconds" 
    ExpiresByType application/x-javascript "access plus 216000 seconds" 
</ifmodule> 

<ifmodule mod_headers.c> 
    # Cache specified files for 6 days(release cycle normally a week) 
    <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$"> 
    # Header set Cache-Control "max-age=518400, public" 
</filesmatch> 
# Cache HTML files for a couple hours 
    <filesmatch "\.(html|htm)$"> 
    Header set Cache-Control "max-age=7200, private, must-revalidate" 
    </filesmatch> 
    # Cache PDFs for a day 
    <filesmatch "\.(pdf)$"> 
    Header set Cache-Control "max-age=86400, public" 
    </filesmatch> 
    # Cache Javascripts for 2.5 days 
    <filesmatch "\.(js)$"> 
# Header set Cache-Control "max-age=216000, private" 
    </filesmatch> 
</ifmodule> 

Все та же проблема. Я начал google и нашел довольно много тем, все говорят, что это проблема браузера клиента.

Итак, я очистил кеш в браузере, попробовал другой компьютер, а также просто запустил файл.

Тот же вопрос

Так что я смотрел на сервер, сделал ИВ на файл: Файл изменен на сервере.

Пропустить что-нибудь? По моему мнению, и может быть только, что apache все еще кэширует файл по HTTP-запросу. http code is 200

На самом деле, добавив временную метку, такую ​​как myurl, com/myfile.css? 525235 решает проблему.

ответ

0

Проверьте настройки, связанные с ETag.

<IfModule mod_headers.c> 
    ExpiresActive On 
    <FilesMatch "!.(gif|jpe?g|png|js|css|php)$"> 
     ExpiresACtive On 
     ExpiresDefault "access plus 1 year" 
     Header unset Cookie 
     Header unset Set-Cookie 
     php_value session.cookie_domain example.com 
    </FilesMatch> 
<FilesMatch "\\.(x?html?|php)$"> 
    Header set Cache-Control "max-age=600, private, must-revalidate" 
</FilesMatch> 
<FilesMatch "\\.(ico|jpe?g|png|gif|swf|woff)$"> 
    Header set Cache-Control "max-age=31536000, public" 
    Header unset Cookie 
    Header unset Set-Cookie 
</FilesMatch> 
<FilesMatch "\\.(css)$"> 
    Header set Cache-Control "max-age=2692000, public" 
    #ExpiresDefault A29030400 
</FilesMatch> 
<FilesMatch "\.(js)$"> 
    #Header set Cache-Control "max-age=2692000, public" 
    ExpiresDefault A29030400 
    </FilesMatch> 
    <FilesMatch "\\.(js|css|xml|gz)$"> 
     Header append Vary: Accept-Encoding 
    </FilesMatch> 
    Header unset Pragma 
    FileETag None 
    Header unset ETag 
    Header append Cache-Control "public" 
</IfModule> 
Смежные вопросы