I'm moving an old website to a new nginx based host. To preserve the URL (which completely changed) I have a file that lists the mapping. I want to use it with map module.
Inside /etc/nginx/nginx.conf http{ ... } I refer to PERL and the lowercase function:
#Include PERL and have a function for lowercasing the incoming URL
perl_modules perl/lib;
    # function to lowercase incoming strings like the URL
    perl_set $uri_lowercase 'sub {
        my $r = shift;
        my $uri = $r->uri;
        $uri = lc($uri);
        return $uri;
    }';
My site configuration, which is in the file /etc/nginx/sites-enabled/notessensei (Thx Alexey to point that out) looks like:
server {
    listen www.notessensei.com:80;
    root /home/stw/www;
    index index.html;
    server_name www.notessensei.com notessensei.com;
    location / {
        map $uri_lowercase $new {
            include /home/stw/www/blognginx.map;
        }
        if ($new) {
                rewrite ^ $new redirect;
        }
    }
    error_page 404 /blog/404.html;
}
The mapping file blognginx.map looks like this:
/blog/d6plinks/shwl-6bv35s /blog/2005/04/garbage-in-.html;
/blog/d6plinks/shwl-6c6ggp /blog/2005/05/just-me.html;
/blog/d6plinks/shwl-6c6gh4 /blog/2005/05/it-is-quotmake-your-own-caption-quot-time.html;
/blog/d6plinks/shwl-6c997j /blog/2005/05/big-business-wwjd.html;
/blog/d6plinks/shwl-6ca5qb /blog/2005/05/domino-on-solaris-anyone.html;
/blog/d6plinks/shwl-6ce65j /blog/2005/05/going-places-vietnam.html;
/blog/d6plinks/shwl-6ce6c9 /blog/2006/02/umsys-as-old-as-unix-sort-of.html;
for about 1300 lines. When I do a service nginx configtest I get a fail. When I don't use the include statement I get an OK. Now I have 2 questions:
- Is there a way to get a more verbose error, one that tells me what is wrong and where?
- What is wrong? Do I need to change the content of the include file? Do I need to move the section?
Help is very much appreciated.
 
     
    