|NAS Adventures, take two
||[Friday 7th February 2014 at 8:02 pm]
|||||Final Battle with Bowser ~ Super Mario Galaxy Original Soundtrack||]|
I've given up on the previous NAS - trying to put together a toolchain is proving to be too much hassle, and while I could blow away the custom firmware and put a stock Debian install on it the internets suggest that the Debian kernel doesn't support DMA at which point your performance drops through the floor. Plus it has a dead hard disk and a noisy fan.
So over Christmas I picked up my dad's other old NAS, a Netgear ReadyNAS Duo v1. Like the Thecus it's also Debian-based, but Netgear are running a real full-fat Debian install. And they provide an official addon to enable root SSH access at which point I can log in, download Debian's already-built toolchain, and use that. Simples!
Plus it also has two working hard disks and a much quieter fan :)
Anyway, now that I have a NAS that is actually usable I've been playing around with running PHP on it. I did try PHP on the Thecus, but it came with some prehistoric version of it (Craig's comment upon seeing the phpinfo output was "where did the other half go?") and the only database it supported was sqlite. Netgear on the other hand ship PHP 5.2 which is almost up-to-date, along with MySQL 5. They even publish a set of instructions at which point the whole exercise is again incredibly easy.
Until I tried installing Craig's Home Portal package, which relies on mod_rewrite at which point everything fell over. See, it was going to go wrong somewhere!
It took a lot of poking around and bashing of config files, but I eventually worked out the problem. See, if you create a HTTP share through the admin webpages it sticks an Options Indexes in the location definition. This disables all server options except for Indexes, at which point mod_rewrite sulks. See, mod_rewrite requires that either FollowSymLinks or SymLinksIfOwnerMatch is enabled, otherwise "you cannot use the rewrite engine... for security reasons". Except the way it handles this is to reject all requests with a 403 Forbidden error.
Fixing this merely requires enabling the missing options, though this is a bit tricky because you can't just put set them in a .htaccess file. Unfortunately the other logical solution of modifying the existing config doesn't work because the admin webpages will blow your customisation away without warning. The solution is to not enable HTTP access to the share through the admin pages, but instead to create a new config file in /etc/frontview/apache/addons/. Put something like the following in it:
Alias /mywebsite /c/mywebsite
Options Indexes FollowSymLinks SymLinksIfOwnerMatch
Allow from all
</Location>Then restart the webserver with /etc/init.d/frontview restart and it should all work (it does for me!).
Next challenge: trying to wring more performance out of PHP! It's a bit sluggish, probably because it only has a 400MHz Sparc processor.