| From | Sent On | Attachments |
|---|---|---|
| hugo | Aug 11, 2011 1:22 am | |
| Maxim Dounin | Aug 11, 2011 3:45 am | |
| hugo | Aug 11, 2011 5:59 am | |
| hugo | Aug 11, 2011 6:02 am | |
| hugo | Aug 12, 2011 12:33 am |
| Subject: | Different FastCGI backend for /subdir: regex not matching | |
|---|---|---|
| From: | hugo (ngin...@nginx.us) | |
| Date: | Aug 11, 2011 1:22:16 am | |
| List: | ru.sysoev.nginx | |
I have a virtual host, and for a certain subdirectory I want to use another fastcgi backend.
What I have now goes something like: (...) location ~ /subdir/ { alias /var/www/otheraccount/public_html/;
# PHP FastCGI location ^~ /subdir\/(.+)\.php { return 504; include /usr/pkg/etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/othervhost/public_html$fastcgi_script_name;
try_files $uri =502; } }
# PHP FastCGI location ~ \.php { include /usr/pkg/etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/blah/public_html$fastcgi_script_name;
try_files $uri =403; } }
Ignore the try_files and bogus return, they're in place to try to trace what's happening where.
This is nginx 1.0.4, if it matters.
Basically, the problem is that the last try_files is triggered (I get a 403 requesting /subdir/index.php, and if I change that last try_files to 404 then I get a 404); Therefore I conclude the regex trying to catch php files under /subdir is not effective.
What would the proper regex be ? I want it to catch /subdir/*.php, /subdir/subsub/*.php, /subdir/s/u/b.php, etc
On a related note, trying to access www.vhost.local/subdir (no trailing /) results in nginx trying to serve subdir from the original root (ie the alias isn't picked up); It may be a trivial question but I've run into this in the past. What is the correct way to catch both /subdir and /subdir/ requests?
I would very much appreciate a reply on this subject, as I've been struggling with this for hours. Regexes are not my strong point.
Thanks.
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,213682,213682#msg-213682
_______________________________________________ nginx mailing list ngi...@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx





