May 12, 2014
1 minute read
Was digging through a stash of guides I use for setting up web server VPSs so I could remember some specifics for a new VPS I was setting up, and I came across an nginx optimization guide that mentioned adding an expires property to a config file to conf.d. I couldn’t remember if I added that to my other two VPSs, so I checked, and nope. Whoops.
Fixed that today and set it to expire after 24 hours. My sites were pretty snappy without it, but with it they got snappier, so that’s good. The only problem is I need to figure out how to disable caching on a specific file name no matter where it is, because I use a PHP script to serve random images for backgrounds in a few of my designs. I could also look into making cache times for images a lot longer, instead of just using one expires property for everything.
If you haven’t added a config file with the expires property in it to your /etc/nginx/conf.d folder yet, definitely do it. Just make a new file titled expires.conf and put this in it:
Here’s a guide I’m going to follow for caching images longer.