[Users] Simple HTTP proxy for sharing a port on the HN?

oneman oneman at onemanifest.net
Wed Dec 8 04:47:07 EST 2010


On Mon, 6 Dec 2010 16:44:11 +0100, Benjamin Henrion <bh at udev.org> wrote:
> 
> I want to host 3 different webservers into 3 different containers, but
> I have only one public IP on the Hardware node.
> 
> Does anybody has a simple config of apache in mod_proxy or lighttpd?

You can NAT all web requests to one container and proxy the requests for
sites that are on another container with apache mod_proxy like this:

<VirtualHost *:80>

        ServerName 	www.example.net

	# Avoid open your server to proxying
	ProxyRequests Off

	<Proxy *>
		Order deny,allow
		Allow from all
	</Proxy>

	ProxyPass / http://www.example.net/
	ProxyPassReverse / http://www.example.net/

	<Location />
		Order allow,deny
		Allow from all
	</Location>

	# Let apache pass the original host not the ProxyPass one
	ProxyPreserveHost On 

	# needed for named virtual hosts
	UseCanonicalName Off

</VirtualHost>


You can even do this with SSL sites, when you use one and the same
wildcard certificate on all containers:

<VirtualHost *:443>

        ServerName 	www.example.net

	# Avoid open your server to proxying
	ProxyRequests Off

	<Proxy *>
		Order deny,allow
		Allow from all
	</Proxy>

	ProxyPass / https://www.example.net/
	ProxyPassReverse / https://www.example.net/

        SSLProxyEngine on
        SSLProxyCaCertificateFile /etc/apache2/ssl/apache.pem

        <Location />
                SSLRequireSSL
                Order allow,deny
                Allow from all
        </Location>

	# Let apache pass the original host not the ProxyPass one
	ProxyPreserveHost On

	# needed for named virtual hosts
	UseCanonicalName Off

</VirtualHost>


HTH,


Peter


More information about the Users mailing list