Friday 12 June 2009

Having a runny nose

This morning I checked my email, which took quite a while, and then went out to try and take some butterfly photos. One of the emails I got was from Pop Photo, which had a link to 20 Easy Techniques For Improving Your Photos. Normally I don't find Pop Photo's articles very interesting as they seem to be quite basic. But while this article was still reasonably basic, I did find it quite good, it's more 20 ideas for photographs than techniques for improving photos.

When I was out chasing butterflies (actually just one skipper I think), I had to constantly blow my nose and also my eyewater kept making it so I couldn't tell if what I was looking at through the camera's viewfinder was in focus or not. Eventually I came home as my handkerchiefs were just too wet and soggy from blowing my nose so much. It was very nice, warm and peaceful where I was though, and I didn't see anyone all the time I was out (maybe a couple of hours).

When I got home I copied the pics to my comp, processed them and sorted them (a bit), did a backup, and then had lunch.

After lunch I played on Animal Crossing for a bit, then I decided to do some more work on my website.

Now, as I thought, with the phpstack Webfaction have set up for me, I do have a copy of apache installed in there for use with my own sites, and they redirect any traffic for my sites to go through my copy of apache. See this post on the WebFaction forums, bear in mind that post is from 2006, I think maybe they now use Nginx to proxy requests to users' copies of apache.

Yesterday I set up 2 subdomains for my site in my WebFaction control panel, static1 and static2, as per the Yahoo guide Best Practices For Speeding Up Your Website. Today I was looking at how to actually implement this. First I found that WebFaction use Nginx to serve static pages (I had configured my static subdomains to use a 'app type' of 'Symbolic link to static-only app').This meant that I didn't get my normal 404 error page when calling a URL that doesn't exist.

I had pointed my static subdomains to the same site root as the main domain, and this meant that I could view/download .htaccess and PHP files when using the static subdomains. Also other apache directives, such as mod_rewrite and password protected directories didn't have any effect when browsing the site through the static subdomains. This is obvious when you think about it (you can't expect Nginx to enact apache directives), but I hadn't thought about it.

So I moved all my static files into a separate folder, and changed the site root for the subdomains to that folder. I'm not sure if it will be possible to protect images from being hotlinked when they're served as a static app. Nginx does have a rewrite module, but I think you have to specify your rewrite rules at the Server configuration level, rather than being able to have .htaccess files, and I doubt I would have access to the relevant Nginx configuration file to set this up.

The other thing I'm not sure about is how to set cache-control for files served statically. Ah - found the answer now, with WebFaction if you're serving static content, you can't set cache control/expires headers. I started reading this good article on caching, then it was dinner time.

After dinner I watched an episode of The Equalizer, then finished reading the article on Caching. From what it says there, it seems that if the server sends a Last Modified date header for an item, then the browser will check whether the item exists in its cache, and whether the one on the server is newer or not, and only download it if the version on the server is newer.

So there doesn't seem to be much point serving static content using WebFaction's 'static-only' app (through Nginx), unless you're serving static content that won't be loaded by the user again (can't think of any situations where this would happen).
I posted a question on the WebFaction forums about this to check whether I'm correct.

Food
Breakfast: Orange marmalade toast sandwich; cup o' tea.
Lunch: 2x cheese on toasts; sweet & crunchy salad; nectarine; plum; Trophy; cup o' tea; Chocolate Sanata.
Dinner: Breaded fish portion; mashed potato; peas; salt; vinegar; ground black pepper. Pudding was a creamy strawberry yoghurt. Coffee.
Supper: Choc chip cookie; malted milk; Oreo; cup o' tea.

No comments: