Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

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

1 Answer 1

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;
    }
  }
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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