Keep getting "does not match "

brokentwig nginx-forum at
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;
        root /var/www/;
        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/;

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

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

                fastcgi_param SCRIPT_NAME $fastcgi_script_name;
                fastcgi_param SCRIPT_FILENAME 

                fastcgi_index  index.php;
                fastcgi_read_timeout 300;
                fastcgi_max_temp_file_size 0;


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

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

Posted at Nginx Forum:,231694,231694#msg-231694

More information about the nginx mailing list