# Keep getting "does not match "

**URL:** <https://www.ruby-forum.com/t/keep-getting-does-not-match/223637>\
**Category:** NGINX\
**Created:** [October 12, 2012, 4:14am UTC](https://www.ruby-forum.com/t/keep-getting-does-not-match/223637 "2012-10-12T04:14:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [October 12, 2012, 4:14am UTC](https://www.ruby-forum.com/t/keep-getting-does-not-match/223637/1 "2012-10-12T04:14:39Z")

</div>

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:

> **[Keep getting "does not match "](https://forum.nginx.org/read.php?2,231694,231694#msg-231694)**
>
> 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/...

---

<div class="post-metadata">

**Author:** ![brokentwig](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c67d28/32.png) [@brokentwig](https://www.ruby-forum.com/u/brokentwig)\
**Post date:** [October 12, 2012, 7:55pm UTC](https://www.ruby-forum.com/t/keep-getting-does-not-match/223637/2 "2012-10-12T19:55:34Z")

</div>

On Thu, Oct 11, 2012 at 10:14:13PM -0400, brokentwig wrote:

Hi there,

> The  
> config below works fine for almost all pages except all images under the  
> /blog/wp-content/gallery/ folder.

The uri-matching location directives you have are:

> ```
> location / {
> location ~ \.php$ {
> location /forum/ {
> location ~ /\.ht {
> 
> ```

What http request is made that leads to unexpected behaviour?

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
