[英]How to rewrite nginx to proxy?
新的重寫。 在主機上運行2個服務:
location /{
#this works fine
proxy_pass http://myMainServiceIp/;
}
location /wordpress{
#works but redirects to http://example.com/wp-admin/install.php
#rather than http://example.com/blog/wp-admin/install.php
proxy_pass http://wordpressServiceIp/;
}
如何將/blog/*params*/*etc*/*etc*
正確轉發到我的wordpress服務?
有兩個獨立但相關的問題。 該location
需要尾隨/
以便proxy_pass
可以正確別名URI。
location /blog/ {
proxy_pass http://wordpressServiceIp/;
}
location = /blog {
rewrite ^ /blog/ last;
}
我添加了第二個位置塊來處理一種特殊情況。
第二個問題是HOME,SITEURL需要指向http://example.com/blog/
。 有關更多信息,請參見此文檔 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.