I needed to configure an Apache (version 2.0.59) server to act as a proxy server. I also needed it to continue to act as a web server. To do so, I added the 3
LoadModuledirectives shown below to the LoadModule section of Apache's
httpd.conf, which is located in
/usr/local/apache2/confon this particular system, which is a Solaris 2.7 server (it will likely be in
/etc/httpd/conf/httpd.conf, if you are running Apache on a Linux system).
The following lines, except for the comment lines, are also needed in
# Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. # Statically compiled modules (those listed by `httpd -l') do not need # to be loaded here. # # Example: # LoadModule foo_module modules/mod_foo.so # LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_http_module modules/mod_proxy_http.so
In this case I wanted to limit access to the proxy server to access from the system itself, e.g. from the loopback address, 127.0.0.1, and two other IP addresses, 192.168.1.3 and 192.168.1.4. I could have also used 192.168.1 to allow access from any 192.168.1.x address.
# # Proxy Server directives. Uncomment the following lines to # enable the proxy server: #
ProxyRequests On # Order deny,allow Deny from all Allow from 192.168.1.3 192.168.1.4 127.0.0.1
After modifying the
httpd.conf file, I restarted Apache with
/usr/local/apache2/bin/apachectl restart. For a Linux system
apachectl restart should suffice, though it is likely located in
/usr/sbin, if you need to specify the full path.
After restarting Apache I was able to configure a browser on the system at the 192.168.1.4 address to use the Apache server as a proxy server. I used the IP address of the Apache server, 192.168.1.1 as the HTTP proxy server address with 80 as the port. I verified that the browser was using the Apache server as a proxy server by pointing the browser on the 192.168.1.4 system to www.showmyip.com. That site showed the address for the system as 192.168.1.1, i.e. it showed the connection as originating from the proxy server rather than the actual system on which the browser was being used.
I was also still able to access webpages on the website I host on the Apache server on the default HTTP port.
If you want to turn the proxy service off, you need only change the
ProxyRequests On line to
ProxyRequests Off and