drupal clean urls

adambot nginx-forum at nginx.us
Sun Sep 8 18:44:08 UTC 2013


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

(names have been changed to protect the innocent ;)

any help is appreciated.


Posted at Nginx Forum: http://forum.nginx.org/read.php?2,242673,242673#msg-242673

More information about the nginx mailing list