1

Is it possible for a RPi server to serve from another RPi on the same network?

I have 2 RPi's on my home network, both running apache servers - Raspberry A is linked to a web domain i.e. mydomain.net, and the router redirects incoming http/https calls to it; Raspberry B is only available inside the network at network IP 192.168.1.123. If possible I'd like to create a html/php page on Raspberry A that relays calls to/from Raspberry B's network IP. Grateful for any advice on how to achieve this.

1

You are talking about a reverse proxy. The apache docs explain it in detail here : https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html

Essentially, you need mod_proxy enabled and then you can use the ProxyPass directive.

Example (from the docs):

ProxyPass "/images" "http://www.example.com/" ProxyPassReverse "/images" "http://www.example.com/"

In the above, any requests which start with the /images path with be proxied to the specified backend, otherwise it will be handled locally.

Note: The ProxyPassReverse is used to make sure that the displayed URLs that make it back to the client are for the proxy not the (unreachable directly) back end server.

  • Just picking this up again. The guidance seems to leave quite a bit inferred. Where is this example supposed to go - /etc/apache2/apache2.conf? Inside directory tags? Do I need to create a directory in web path to link the setting to? Does it need to include anything? I'm probably over-complicating it, but this documentation does seem light.. – geotheory Feb 22 '17 at 1:35
  • In sites-available/default (or the .conf file for the particular site, if you're hosting multiple) inside the <VirtualHost> element create a <Location> element and add the two directive above inside that. – KennetRunner Feb 22 '17 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.