location ~ /(test1|test2|test3|test4) {
proxy_set_header Host "test.com";
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1;
}
if ($request_filename !~* ^/(.*)\.(zip|js|ico|css|php|xml|txt|html|swf|apk|ipa|plist)$) {
rewrite ^/(.*)$ /index.php last;
}
The above proxy rules will not take effect. If you delete the rewrite rules, it will be fine. Is there a conflict? How to modify it?
rewrite
优先级较高,导致路径已经先被重写了。可以都改用location
Go and match.But are you sure that static files also need to be rewritten to
index.php
?