Drupal clean urls

Greetings

I have followed all the instructions in the wiki, and when i set my
drupal
installations as the root, everything works, however, when i move my
drupal
into a folder i am able to get everything to work except clean urls.

Here is my drupal config:
location /blog {
# This is cool because no php is touched for static
content
try_files $uri @rewrite;
}

    location @rewrite {
            # You have 2 options here
            # For D7 and above:
            # Clean URLs are handled in

drupal_environment_initialize().
#rewrite ^ /blog/index.php;
# For Drupal 6 and bwlow:
# Some modules enforce no slash (/) at the end of the
URL
# Else this rewrite block wouldn’t be needed
(GlobalRedirect)
rewrite ^blog/(.*)$ blog/index.php?q=$1;
}

    location ~ blog/.*\.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            #NOTE: You should have "cgi.fix_pathinfo = 0;" in 

php.ini
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
}

    # Fighting with Styles? This little gem is amazing.
    # This is for D6
    #location ~ ^/sites/.*/files/imagecache/ {
    # This is for D7 and D8
    location ~ ^/blog/sites/.*/files/styles/ {
            try_files $uri @rewrite;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires max;
            log_not_found off;
    }

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: 192.168.1.1, server: localhost, request:
“GET
/blog/linux HTTP/1.1”, host: “example.com”, referrer:
http://example.com/blog/

(names have been changed to protect the innocent :wink:

any help is appreciated.

thanks!
Adam

Posted at Nginx Forum:

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: 192.168.1.1, 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.

f

Francis D. [email protected]

Changing the rewrite from blog to /blog worked perfectly – thanks for
the
second set of eyes :slight_smile:

I’m not sure on the busy-work part – i took most of the stuff from the
nginx wiki on drupal (still learning config files, been running nginx
for
about 24 hours now)

Posted at Nginx Forum: