0

I maintain two Debian Linux servers, A and B. A is rather old and runs a old PHP installation (5.4), while B runs a newer (7.2). Both run Apache as a web server. Server A uses PHP as a module, while server B uses PHP FPM.

What I'd like to do is to have the same domain name for both servers, eg. mydomain.com. When a visitor requests mydomain.com/pathA the response should originate from server A, while requests to mydomain.com/pathB the responses must originate from server B.

I've read that nginx can do this. If there's a third server, eg. C with nginx installed, it could act as a reverse proxy for both servers.

First of all, is what I think possible with nginx? If so, could you please point me to some examples for configuring nginx to work like this?

Thank you.

  • The jargon for the configuration you want/need is indeed “reverse proxy” and the associated nginx directive is `proxy_pass`. The manual should be a good start – HBruijn May 08 '23 at 19:34
  • I have this snippet in the code configuration: location /mypath/ { proxy_pass http://myserver/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } It works for resources that reside in the / of myserver, but everything under a suburi (like /css or /images) returns a 404. Apparently the requested url does not get rewritten under the /mypath url. Any ideas? – Vasilis Lourdas May 09 '23 at 06:55
  • 1
    That is much clearer and specific question than your original one. Note that you can edit your question rather than (only) adding those details in a comment where almost all formatting gets lost. - You might want to look at this Q&A https://serverfault.com/a/932636/37681 – HBruijn May 09 '23 at 07:43

0 Answers0