NGINX Config Update

Posted by John
on Tuesday, 04 March 2008

Using the Firebug addon YSlow from Yahoo I managed to tune site performance a little more by adding 'expires' to the nginx.conf file

location ~* ^.+.(jpg|jpeg|gif|js)$ { root /var/www/apps/myapp/public; access_log off; expires 30d; }

What this basically does is tell NGINX that any files of type jpg, jpeg, gif, and js with the root dir specified shouldn't be logged for access and have an expires value set to 30 days.

As most of the images I use on-site don't change that much this works perfect for me.

Updated my NGINX example files in the [CODE DOWNLOADS] area so you can grab a copy.

More tips located at...

Feedback
(required)