Setting up Apache as a Proxy HTTP Server

The famous Apache Web Server has one very useful configuration option — the Proxy Server. Below are steps for Setting up Apache as a Proxy HTTP Server. With this option you have the following advantages:

  • You have a direct access to the internet with a HTTP server running and you want to offer another HTTP Server for one of your friend under his name. Your friend is connected with you through a LAN or WAN connection, but your friend has no direct internet connection.
  • You want to hide your “real” HTTP Server IP-Address behind a Proxy HTTP Server.
  • You want to cache the most used HTML pages used in your Intranet for your clients.
The installation and configuration of the Apache HTTP Proxy Service is very easy. In the following example we show you the necessary entries in the Apache configuration file httpd.conf for the first case (Serving a HTTP Proxy Server for your friend).
Let’s suppose, that your HTTP Server with direct internet access is on 193.172.194.10. For your friend HTTP server you establish the IP-Address 193.172.194.42 on Port 80. Of course, this HTTP Server is not only a Proxy Server, it’s a real full featured Apache Server with the Proxy module enabled. Your friend has his own Apache Server on 193.247.125.196 and you are connected through a LAN connection with this server. Specify the following Proxy Server directives within a virtual host entry in the configuration file httpd.conf for your HTTP Server.
<VirtualHost 193.172.194.42:80>
ServerAdmin   yourname@yourdomain.domain
ServerName    yourfriend.yourdomain.domain
ServerPath    /yourfriend
ErrorLog      logs/yourfriend.error_log
TransferLog   logs/yourfriend.access_log
ProxyRequests On
ProxyPass     / http://193.247.125.196/
</VirtualHost>
ServerAdmin
E-Mail address for automatic pages generated when some errors occur.
ServerName
You must specify a hostname and IP-Address for your friends machine. The hostname must no be equivalent with the real hostname of this machine on your friends site.
ServerPath
Let your friends name be accessed through the following URL:
http://yourfriend.yourdomain.domain/yourfriend
ErrorLog
Logfile for yourfriend’s site
TransferLog
Accesslog  for yourfriend’s site
ProxyRequests
This directive turns proxy serving on for this virtual host
ProxyPath
This directive passes requests to your friends HTTP Server on 193.247.125.196.
This entry was posted in Linux and tagged . Bookmark the permalink.