logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Raspberry Pi help with mod proxy and proxypass
Author
martyp



Joined: 01 Nov 2015
Posts: 3

PostPosted: Sun 01 Nov '15 14:38    Post subject: Raspberry Pi help with mod proxy and proxypass Reply with quote

Hi all,
I'm getting really confused trying to get this working and would really appreciate some help please Smile
I've been getting some great help from the Raspberry Pi forums but still getting lost on this.

Basically, here's the setup I currently have:
3 X Raspberry Pi's all running web based projects.

1) Weather station on 192.168.1.39
2) Thermostat activity on 192.168.1.42:82
3) Electricity monitor on 192.168.1.43

Port 80 on my router forwards to my main website on 192.168.1.39 and port 82 forwards to 192.168.1.42.

I've been trying to get Proxypass working on the weather station Pi.

I'm trying to set it up as follows:

www.domain.co.uk -> Weather station
www.domain.co.uk/thermostat -> 192.168.1.42
www.domain.co.uk/electricity -> 192.168.1.43

I've added the following lines to the bottom of apache2.conf:
ProxyPass /thermostat http://192.168.1.39/
ProxyPassReverse /thermostat http://192.168.1.39/

ProxyPass /electricity http://192.168.1.43/
ProxyPassReverse /electricity http://192.168.1.43/

and tried creating a file called electricity in sites-available on weather station as follows:
<VirtualHost *:*>
ProxyPreserveHost On
ProxyPass / http://192.168.1.43/
ProxyPassReverse / http://192.168.1.43/
ServerName www.domain.co.uk/electricity
</VirtualHost>

I tried using sudo a2ensite to enable electricity but it said no site found.
I'm really not sure if I'm editing the right files in the right places?
Please can someone help?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 02 Nov '15 15:40    Post subject: Reply with quote

The ServerName can't be a path. if you have only one domain you don't need any vhost.

if there is only one domain I recommend to disable the vhost or do all stuff in that vhost file. Also put all Proxy* stuff into the existing vhost.

use

Code:
sudo apache2ctl -S
for a syntax check and display of the vhosts. it might be apachectl instead of apache2ctl depending which distro you use.
Back to top
martyp



Joined: 01 Nov 2015
Posts: 3

PostPosted: Mon 02 Nov '15 21:29    Post subject: Reply with quote

Thanks for the reply, I tried that command and got:
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 127.0.1.1 (/etc/apache2/sites-enabled/000-default:1)
*:* <mydomain.co.uk>/electricity (/etc/apache2/sites-enabled /electricity:1)
*:* <mydomain.co.uk>/thermostat (/etc/apache2/sites-enabled/ thermostat:1)
*:80 is a NameVirtualHost
default server <mydomain.co.uk> (/etc/apache2/sites-enabled/virtual-re verse-proxy:1)
port 80 namevhost <mydomain.co.uk> (/etc/apache2/sites-enabled/virtual -reverse-proxy:1)
Syntax OK

Sorry, which would be the vhost file I'd need to change? I worried I made a mess as I created one for electricity and another for thermostat with Proxypass commands in but then tried putting them all into one called virtual-reverse-proxy.
Back to top


Reply to topic   Topic: Raspberry Pi help with mod proxy and proxypass View previous topic :: View next topic
Post new topic   Forum Index -> Apache