conditional location using nginx
I'm running a forums site behind cloudflare and I'm trying to make my
location statements more efficient but I'm not really sure what I'm doing.
I read nginx extending a rewrite rule with a condition plus some others
and it didn't really address my particular issue.
So, I have a few location statements in my nginx.conf;
location / {
location = /404.html {
location = /50x.html {
location ~ ^/(fpm_status|fpm_ping)$ {
location ~ \.php$ {
location /xcache/ {
location ~ \.php$ { #nested under xcache
location /munin/ {
location /nginx_status {
Now, my site is under a /forums directory (Invision, if it makes any
difference) and as cloudflare provides a direct subdomain for a direct
connection without going through the cache, I really want to utilise this
for pingdom.
BUT, using direct.example.com/[xcache/fpm_status/fpm_ping/munin] etc is
fine, but unfortunately direct.example.com/forums redirects straight to
www.example.com/forums.
So, I'm wondering if my top level \.php$ is the problem? If I nested that
under / it would allow for www AND direct subdomains to work. Am I right?
Because I'm assuming that the php location is matched when the others
haven't matched. Ie, its the 'next best match' scenario?
Thanks in advance for any assistance.
Christian
No comments:
Post a Comment