Forum: NGINX Keep getting "does not match "

Posted by brokentwig (Guest)
on 2012-10-12 04:14
(Received via mailing list)
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
Posted by Francis Daly (Guest)
on 2012-10-12 19:55
(Received via mailing list)
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 Daly        francis@daoine.org
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.