I have a Server-a which only contains a Nginx and a node application in execution.
However, I want to serve the Node app from that server, which is also serving an Angular application.
But when I navigate to server-a/blog, I want to make a reverse proxy (internal proxy) to a different server (Server-b), which contains a Wordpress setup, also with a Nginx.
So, always I navigate to server-a/blog, serves the content of the server-b
I have it partially working with this configuration:
proxy_buffering on;
proxy_buffer_size 1k;
proxy_buffers 24 4k;
proxy_busy_buffers_size 8k;
proxy_max_temp_file_size 2048m;
proxy_temp_file_write_size 32k;
location /blog/en/ {
try_files $uri @proxy;
}
location @proxy {
proxy_redirect off;
proxy_set_header X-Forwarded-Host "$host";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://server-b;
}
But what happens is: If I navigate to server-a/blog/wp-admin, I get an instant redirection to server-a/wp-admin.
All the relative links on the Wordpress installation must be accordingly with the server-a URL.
This is the setup I have on my Wordpress DB setup:
+-----------+-------------+-----------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+-----------------------+----------+
| 1 | siteurl | http://server-a/blog/ | yes |
| 2 | home | http://server-a/blog/ | yes |
+-----------+-------------+-----------------------+----------+