Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've a Django application with a directory /media/ for all static files. (css, images, js)

I want to speed up the serving of these files with Apache cache control.

How can I setup cache control for ALL that directory?

UPDATE

I've put this in my /etc/apache2/site-available/mysite.com

 <Directory "/srv/www/mysite.com/myproject/media/">
 Options -Indexes
 Header set Cache-Control "max-age=108000, public"
 </Directory>

But I get this when I try to load my site with Firefox:

enter image description here

What is in Request Heards Cache-Control: max-age=0 ? It is not wrong?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You could use ExpiresDefault inside <Directory "/path/to/media"> to set cache control to all files within this directory. See mod_expires documentation

share|improve this answer
    
check my update please. –  Fred Collins May 13 '11 at 19:35
    
Request Headers is what your Firefox has sent to server. Quick googling says that Firefox does so when user hits Reload button. –  AlexD May 14 '11 at 9:00
    
Ok guy. Thank you. –  Fred Collins May 14 '11 at 19:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.