drupal clean urls

Francis Daly francis at daoine.org
Sun Sep 8 21:10:20 UTC 2013

On Sun, Sep 08, 2013 at 02:44:08PM -0400, adambot wrote:

Hi there,

not tested, and I don't know what exactly drupal expects, but...

>         location @rewrite {

>                 rewrite ^blog/(.*)$ blog/index.php?q=$1;

That "rewrite" line is unlikely to do anything. The uri that "rewrite"
tests starts with a /, so "^blog" will never match.

Perhaps replace "blog" with "/blog" twice, and see if that does what
you want?

Separate from that, and this is more "busy work" than "actually broken"...

>         location ~ blog/.*\.php$ {
>                 fastcgi_split_path_info ^(.+\.php)(/.+)$;

That line probably does nothing useful. There aren't many urls that
both end in ".php" and contain the string ".php/". Something like
/blog/one.php/two.php *would* match -- but does your drupal use urls
like that?

> Here is the error i am seeing in my log:
> [error] 12988#0: *1 open() "/var/www/html/blog/linux" failed (2: No such
> file or directory), client:, server: localhost, request: "GET
> /blog/linux HTTP/1.1", host: "example.com", referrer:
> "http://example.com/blog/"

I suspect that if you turned on the debug log, you'd see what rewrites
were actually used; and you could match that against what you expect
nginx to do.

But the blog -> /blog change may be enough to get things going.

Francis Daly        francis at daoine.org

More information about the nginx mailing list