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.

Likewise in Apache is there a way you can setup multiple headers in nginx?

      location ~.*\.(css|html|js)$ {
      expires 30d;

I currently have that set, but I was thinking to make js and css expire after 90 days instead.

Is that possible?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Yes, you can. See the HttpHeaders and HttpHeadersMore modules.

Why would you need multiple headers to do that, though? It seems this would suffice:

   location ~.*\.html$ {
     expires 30d;
   }
   location ~.*\.(css|js)$ {
     expires 90d;
   }
share|improve this answer
    
Thanks will look into this. Though I temporarily had Apache serve those files and for now that seems to be working. –  Chirag Jun 8 '11 at 19:50
add comment

Generally, you don't want to cache HTML pages, since they are usually static assets like CSS/JS. If you ever decide to change your HTML files, with your current 30d expires setup browsers which have already visited the site within 30 days will not request the new page.

If you, in fact, know that your HTML pages are NOT going to change except until a specific date, then you can use Expires with a given date instead of just a general 30days form when the request is served.

But you probably don't want to cache HTML...

share|improve this answer
add comment

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.