nginx wordpress重写规则与stub_status模块冲突

我有一个问题,当我试图启用stub_status模块在我的WordPress的网站。 以下是我在nginx.conf中的configuration。

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

我的问题是我可以访问状态页面,如果我删除了WordPress的重写规则。 如果存在重写规则,则状态页面不起作用。 有谁知道如何解决这个问题?

其实,你的重写属于server部分,所以不存在location /status机会。 所以,你需要把你的重写条件放到其他location 。 PS我不知道这是否是工作configuration,但我想,这个想法是交付。

 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; } } }