i'm got a problem when i was trying to enable stub_status module on my wordpress based site. the following is my configuration in nginx.conf.

location /status {
stub_status on;
access_log off;
}
if (!-e $request_filename){
rewrite ^(.+)$ /index.php?q=$1 last;
} 

my problem is i can access the status page if i remove the wordpress rewrite rule. if the rewrite rule exist, the status page not works. does anyone know how to fix this problem?

link|improve this question
Don't use "(if !-e ...)", use try_files. – sendmoreinfo Dec 25 '11 at 12:13
feedback

1 Answer

Actually, your rewrite belongs to server section, so there's no chance for location /status. So, all you need is to put your rewrite condition into other location. P.S. I'm not sure that this is working config, but I think, that idea is delivered.

server {
  listen 80;
  server_name myserver.com;

  location /status {
    stub_status on;
    access_log off;
  }

  location ~* \.(ico|jpe?g|gif|bmp|png|js|css)$ {
    access_log off;
    expires max;
  }

  location ~* (!\.(ico|jpg|jpeg|gif|bmp|png|css|js))$ {
    if (!-e $request_filename) {
      rewrite ^/$ /index.php last;
    }
  }
}
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.