2009年3月11日 星期三

Map Remote Servers into the Space of the Local Apache Server with Authentication on Ubuntu

1. delete symbolic link of the default proxy.conf

sudo rm /etc/apache2/mods-enabled/proxy.conf

2. make another copy of proxy.conf in the same folder, mods-enabled

sudo cp /etc/apache2/mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf

3. edit it

sudo vi /etc/apache2/mods-enabled/proxy.conf
--

ProxyVia On

ProxyPass /mirror/ http://address:port/
ProxyPassReverse /mirror/ http://address:port/

<Location /motion/>
AuthName "TITLE"
AuthType Basic
AuthUserFile /var/www/.htpasswd
require valid-user
</Location>

# ProxyPass causes a local request for the http://localhost/mirror/ to be internally converted into a proxy request to http://address:port/
# ProxyPassReverse provides location header on http adjusting which redirects http://localhost/mirror/sub/ to http://address:port/sub/ also

4. generate apache password file, /var/www/.htpasswd

sudo htpasswd -c /var/www/.htpasswd username

沒有留言: