Webserver Proxying - single public Apache HTTPD, multiple internal subdomains.
I needed only one Apache HTTPD server visible over the Internet, and subdomains provided by internal webservers. I proceeded with mod_proxy.
On SLES10, go to /etc/apache2 and create a file named proxy.conf:
# Sample configs
# by hardwyrd
# 05/22/2009
#
# Disclaimer:
# Use at your own risk. It works for me, it might not work for you.
# If you decide to use or follow this config, you agree that I am not responsible for the damage
# to your system.# Listen on internal interface only. Only mod_proxy uses this.
Listen 192.168.10.1:8080
# Set the user for mod_proxy
User nobody
Group nobody# Turn on proxy requests
ProxyRequests OnOrder deny,allow
Deny from all
# Declare your subdomain rechable from the internet.
Order deny,allow
Deny from all# Allow only from specific IP addresses or allow all if this is accessible from the net.
Allow from all# You can add as many
declarations as you can.
Create a virtual host on the public-facing Apache server. In SLES10, the config is at /etc/apache2/vhosts.d:
# Sample configs
# by hardwyrd
# 05/22/2009
#
# Disclaimer:
# Use at your own risk. It works for me, it might not work for you.
# If you decide to use or follow this config, you agree that I am not responsible for the damage
# to your system.# A virtual host config is needed so that we can redirect the subdomain requests coming in at port 80 to the internal Apache server.
# Create equivalent virtual host entries for every
declaration in the proxy.conf .
ServerName your-subdomain.your-domain.tld
ServerAlias your-subdomain.your-domain.tld
ProxyPass / http://your-subdomain.your-domain.tld/
ProxyPassReverse / http://rspace.focusoutsourcing.com/
To enable the public Apache server forward the requests to the proper internal Apache server, you can use an internal DNS server with the correct A record for the domain pointing to the IP of the internal Apache server. Or, the quickest way is to add the subdomain to the hosts file (/etc/hosts).
#/etc/hosts
192.168.10.22 your-subdomain.your-domain.tld
On the internal Apache server, create a standard virtual host for the subdomain.
That’s it! Only one apache server will be visible to the public, and yet serve multiple subdomains, spread among various internal Apache servers.
Enjoy!
Technorati :
apache, mod_proxy, web+server, linux
Site Search Tags: apache, mod_proxy, web+server, linux











We needed a helpdesk and a knowledgebase system and we prefer that it be opensource. We have found 
