Archive for November 2009

Use Apache’s mod_proxy to Set Up a Proxy Server

leave a comment »

A proxy server is a server that sits between your computer and the internet and services your requests to the internet. Many companies use proxy servers to filter employee internet requests since a proxy server can also modify or block your request.

My goal in setting up a proxy server was to give myself a means of encrypting my web traffic when I am in insecure locations such as airports and restaurants.

To set up a proxy server, you first need a server. You can use a machine on your home network, get a dedicated server, or get a virtual server. I chose to get a virtual server through I am using their base $20 256 slice with Ubuntu 8.04 LTS. In addition to proxy services I also use it as a virtual desktop and, since I can leave it on all the time, run long term jobs.

I set up the proxy server to only allow connections from the local host. I can then connect to the local machine via SSH and surf the web through the SSH tunnel. This way, the connection to my server is encrypted and no one can use the proxy server unless they have an account on my machine.

The setup is simple but I had to go to several sources to figure it all out, hence this article.

First, install Apache:

apt-get install apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert

Next, link to the mod_proxy modules:

cd /etc/apache2/mods-enabled
ln -s /etc/apache2/mods-available/proxy_http.load
ln -s /etc/apache2/mods-available/proxy_ftp.load
ln -s /etc/apache2/mods-available/proxy_connect.load
ln -s /etc/apache2/mods-available/proxy.load

Then, in your httpd.conf file located at /etc/apache2 make
entries to configure the server:

ProxyRequests On
ProxyVia Block
<Proxy *>

   Order deny,allow
   Deny from all
   Allow from

Here, ProxyRequests configures Apache as a forward proxy. <Proxy *> and </Proxy> delineate the proxy configuration block. The block tells Apache to deny all connections except from the local machine (

Now, restart Apache:

apache2ctl graceful

Finally, in your browser configure your host to use the proxy server you just set

Sources: Ubuntu Hardy Apache and PHP install guide Configuring Apache 2.0 as a Forward Proxy Server

Written by M Kapoor

November 1, 2009 at 11:40 pm