0

I have a Raspberry (say pi-1) running an apache2 web server that serves to the internet (my.domain). I have a second Pi (pi-2) also running apache2 that serves to the local network over it's local IP address (192.168.1.100). Is there a way to configure a subdomain of pi-1 - e.g. sub.my.domain - that relays requests on to 192.168.1.100 and responses back to the client?

1 Answer 1

4

You can setup apache on the first board with a virtual host entry that matches the sub-domain, and uses the mod_proxy module to send the request on to the second board. See the example at apache virtual hosts

<VirtualHost *:*>
    ProxyPreserveHost On
    ProxyPass "/" "http://192.168.1.100/"
    ProxyPassReverse "/" "http://192.168.1.100/"
    ServerName sub.my.domain
</VirtualHost>
2
  • Thanks @meuh. Does this go in /etc/apache2/apache2.conf? Commented Jun 3, 2016 at 18:23
  • I dont have apache on a pi, so I cannot say, but it goes in with the other configuration directives. But you really must read the linked-to page, and look up each of the directives above (ProxyPass and so on) so you understand what is going on. My answer is just a starting point. Commented Jun 3, 2016 at 18:44

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.