New to rewrites. Running 2 services on my host:
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/;
}
How can I forward /blog/*params*/*etc*/*etc*
to my wordpress service correctly?
There are two separate but related issues. The location
needs a trailing /
so that proxy_pass
can alias the URIs correctly.
location /blog/ {
proxy_pass http://wordpressServiceIp/;
}
location = /blog {
rewrite ^ /blog/ last;
}
I have added the second location block to handle the one special case.
The second issue is HOME and SITEURL needs to point to http://example.com/blog/
. See this document for more.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.