Keep getting "does not match "

brokentwig nginx-forum at nginx.us
Fri Oct 12 02:14:13 UTC 2012


I have a complicated setup where I'm running WordPress in the /blog/
subfolder, and then Vanilla Forums 2 in the /forums/ folder under root.  The
config below works fine for almost all pages except all images under the
/blog/wp-content/gallery/ folder.  In the log I keep getting "/forum/" does
not match "/blog/wp-content/gallery/something_something...".  Shouldn't
"/blog/wp-content/....." be matched on the "location /" entry?  I have
confirmed the path is accurate for the images, so the try_files under the
main "locaton /" should catch it.  Any help would be appriciated:


server {

        #error_log /var/log/nginx/rewrite_log notice;
        rewrite_log on;

        listen  80;
        server_name domain_name.com www.domain_name.com;
        root /var/www/domain_name.com/blog;
        index index.php index.html;

        # Main site is the blog, so last condition rewrites for WP
        location / {
                try_files $uri $uri/ @blog;
        }

        location @blog {
                try_files $uri $uri/ /index.php?p=$uri$is_args$args;
        }

        location ~ \.php$ {
                include /etc/nginx/fastcgi_params;

                # Set default script path to WP blog
                set $php_root /var/www/domain_name.com/blog;

                # If this is a forum request, change the root
                if ($request_uri ~ /forum/) {
                        set $php_root /var/www/domain_name.com;
                }

                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param PATH_TRANSLATED
$document_root$fastcgi_path_info;

                fastcgi_param SCRIPT_NAME $fastcgi_script_name;
                fastcgi_param SCRIPT_FILENAME 
$php_root$fastcgi_script_name;

                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_read_timeout 300;
                fastcgi_max_temp_file_size 0;

        }

        location /forum/ {
                root /var/www/domain_name.com;
                if (!-e $request_filename) {
                        rewrite ^/forum/(.*)$ /forum/index.php?p=$1 last;
                        break;
                }
        }

        location ~ /\.ht {
                access_log off;
                log_not_found off;
                deny  all;
        }
}

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



More information about the nginx mailing list