DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Apache2 Proxy To Local Port
Apache as the receptionist, forwarding requests to and from an internal server (e.g. webrick or lighttpd).
<VirtualHost *>
ServerName www.example.com
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
ProxyPreserveHost On
</VirtualHost>
Change 3000 to whatever port you need and make sure the internal server is set up to answer requests on that port (not port 80). The ProxyPreserveHost line is critical to keep all your URLs working correctly.






Comments
Snippets Manager replied on Sat, 2011/08/13 - 11:30pm
Snippets Manager replied on Thu, 2007/05/31 - 10:42am
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.*) http://localhost:3000/$1 [P]Yuri Soldak replied on Thu, 2007/03/01 - 5:58am
RewriteEngine on RewriteRule (.*) http://localhost:8080/folder2/$1 [P]No additional changes are required (except enabling .htaccess in apache2.conf if disabled) in /etc/apache2