OK let's see if this works.
LINUX QUESTION!
I'm migrating a 15 year old Windows webserver to Linux. That's 15 years of not caring about case sensitivity in filenames, which I predict will result in endless 404s when nginx & Linux take over.
What's a nice elegant way to handle this, short of editing and renaming 15 years of stuff until the 404s go away?
@kemonine @NFG Quick and dirty: https://stackoverflow.com/questions/152514/how-to-rename-all-folders-and-files-to-lowercase-on-linux
... but this solves only half of the problem. It won't fix broken links in your web pages.
@thomas @NFG I'd STRONGLY recommend NOT using REGEX to fixup any URLs in HTML code...
I've attempted it before and, well, you don't want to do that.
I'd look at beautiful soup and other libraries to re-work the HTML links. They cover a LOT of corner cases you won't want to be figuring out as you fixup URLs.
@NFG Back in the Apache days, there was a mod for that. nginx may have an equivalent, maybe searching on nginx mod_speling might help? https://httpd.apache.org/docs/current/mod/mod_speling.html
@zigg @NFG I agree, probably not something too concerning.
However, if there are php-fpm or uwsgi apps that get lit up under the hood or behind the nginx config case sensitivity will likely be a lot more important suddenly.
Might be smart to migrate to a more typical case sensitive approach and front-load the pain as part of the migration rather than being bitten in some creative way further down the line.
@kemonine @NFG I wouldn't expect a mod that could find close matches for static content out of a directory of files to interfere with the operation of any proxy-style connector.
Mind, I won't say it could never happen 😄 but I'd consider that buggy behavior. Trying to fix casing and spelling in requests requires a list of possibilities to match to, something that a directory full of static content supplies and a proxy-style connector does not.
@zigg
@kemonine
@galaxis
@thomas
Thank you all for the suggestions, you've been incredibly helpful. <3
I suspect the number of things to fix will be fewer if I don't slam every file into lower case, because that's going to break -every- mixed case link on dozens of scripts and platforms.
Perhaps something in the 404 processing that scans the dir to an array, then strtolower both request and the files, and return the match..?
@NFG The solutions I have seen usually use the nginx Perl module to rewrite the request URL to all lowercase (provided you have renamed all the files accordingly and there are no collisions).
@NFG There should be some quality bulk file naming tools out there.
If you're feeling really IT adminy you could put together a Python/Ruby/NOT Bash language and walk the file system looking for collisions.
I'd recommend a little googling to see what may already be existing.
You could also toss your hands up and just eyeball the logs in nginx for a few years 😉