Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Apr 302011
 

Enable Expire header in Nginx

Answer:

Enabling Expire header for static contents is useful to reduce the loading of your web server.

If you are using nginx, it is easy by adding the following lines in your nginx.conf

location ~* \.(ico|css|js|gif|jpe?g|png)$ {
    expires max;
}

So all files with the above extensions will be delivered with the maximum expire header.

If you want user to update the cached contents, make sure you have change the path (i.e. rename) of these resources.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>