I have a load balancer (Nginx) and another Apache server which is hosting a wordpress blog (at /blog). I want all my traffic on my load balancer at /blog
to go to this Apache server. I have the following settings:
upstream main_app {
server main_app_address;
}
upstream blog {
server blog_address;
}
server {
server_name appname.com;
return 301 http://www.appname.com$request_uri permanent;
}
server {
listen 80;
server_name appname.com;
location / {
client_max_body_size 8M;
proxy_pass http://main_app;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
}
location /blog {
proxy_pass http://blog/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
}
}
This shows me the directory listing on the Apache server at /
where I can see the /blog
however that is not what I want, I want it to show the contents of /blog
from the Apache server.
If I remove the trailing slash in the /blog location directive I end up with endless redirects.
How do I solve this?