Monday, July 07, 2008

enable mod expire for fast image loading

here is the example from google (they have set the cache expire far far in the future )


$ curl -I http://www.google.ro/logos/chagall.gif

HTTP/1.1 200 OK
Content-Type: image/gif
Last-Modified: Mon, 07 Jul 2008 04:33:28 GMT
Expires: Sun, 17 Jan 2038 19:14:07 GMT
Cache-Control: public
Date: Mon, 07 Jul 2008 10:09:52 GMT
Server: gws
Content-Length: 16715


here is my configure.nice script for apache 2.2.x

"./configure" \
"--prefix=/opt/apache2.2" \
"--enable-so" \
"--enable-mantainer-mode" \
"--enable-module=all" \
"--enable-rewrite" \
"--enable-include" \
"--enable-info" \
"--enable-expires" \
"$@"

also after all is build and installed (apache server restarted)
you can check the expire config

$/opt/apache2.2/bin/httpd -l | grep expire

or in browser
http://example.com/server-info?mod_expires.c

and add the expire config into the httpd.conf or .htaccess

ExpiresByType text/html "access plus 1 month 15 days 2 hours"
ExpiresByType image/gif "
access plus 1 month 15 days 2 hours"

you can check later the expire headers with curl

$curl -I http://example.com/images/example.gif

HTTP/1.1 200 OK
Date: Mon, 07 Jul 2008 12:18:14 GMT
Server: Apache/2.2.8 (Unix) PHP/5.2.6
Last-Modified: Tue, 01 Jul 2008 13:57:59 GMT
ETag: "3884a9-2348f-450f6c38087c0"
Accept-Ranges: bytes
Content-Length: 144527
Cache-Control: max-age=3895200
Expires: Thu, 21 Aug 2008 14:18:14 GMT
Content-Type: image/gif

3 comments:

Unknown said...

Hello Mariuz.

I have a thing to say about the Firebird installation:

SWEET!

It worked just fine!

On the first time I've installed, I probably missed the part of the package configuration.

I'll pay more attention on my future installations and use more the Console than the visual package manager.

Once again, thank you so much.

Popa Adrian Marius said...

ok then :)

i will put that part in red and bold

usually in my opinion it should be enabled by default , but damyan told me firebird 2.1 should be disabled after install , and it will be configured only when the user wishes to do so

Popa Adrian Marius said...

also you can use the firebird-support list if you have any issues

http://tech.groups.yahoo.com/group/firebird-support/messages