I am going to have a raspberry pi 3b+ hosting 2 web applications:
Pi-hole (that's a link)
and MotionEye (another link)

I want to host both of the web interfaces on port 80 without using two
subinterfaces (It messes with the dataplicity agent) After looking into apache2, I found that one can foward a local webpage to an apache page using the Mod_Proxy module, but the examples I could find
don't include subdomain examples. Basically I am looking for this structure:
www.example.com/motioneye shows the motioneye webapp
www.example.com/pihole shows th pi-hole webapp
Does anyone know how I could do this?


I've got four Raspberries on my network, one is open to the public internet on port 80 and port 443. The other three are LAN only (running web servers on port 80 (8080 for Challenger)) but have some web pages that are available on the internet with mod_proxy.

ProxyPass /RPioneer http://pioneer.local/
ProxyPassReverse /RPioneer http://pioneer.local/

ProxyPass /RBeaufort http://beaufort.local/
ProxyPassReverse /RBeaufort http://beaufort.local/

ProxyPass /RFaware http://challenger.local:8080/
ProxyPassReverse /RFaware http://challenger.local:8080/
ProxyPass /RFaware/data http://challenger.local:8080/data
ProxyPassReverse /RFaware/data http://challenger.local:8080/data
ProxyPass /data   http://challenger.local:8080/data
ProxyPassReverse /data   http://challenger.local:8080/data
ProxyPass /images http://challenger.local:8080/images
ProxyPassReverse /images http://challenger.local:8080/images

Pioneer is my test machine. Beaufort is my weather station. Challenger is running Piaware (collecting data for FlightAware) [which is why it's altogether more complex]. I'm using the Avahi *.local addresses rather than coding the static IP addresses for those machines - because it's easier to address a machine by its hostname.local mDNS name.

Don't know how you'd do that with PiHole - but in theory if it's running Apache2 there must be a /etc/apache2/sites-enabled config for the webserver.

  • It actually runs lighttpd, but i would use apache2 to present both pages based on the subpage. Is there a file this goes in? When I first tried this, my config file looked nothing like this lol.
    – pcs3rd
    Apr 30 '19 at 20:33
  • That stuff goes in your <virtualhost> container.
    – Dougie
    Apr 30 '19 at 22:35
  • found it. The config file is in /etc/apache2. Thank You very much. I ended up using nginx (apache wasn't passing css for motioneye), but it is a similar syntax.
    – pcs3rd
    May 1 '19 at 0:07

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.