Tuesday, June 25, 2013
I used mod_proxy to point a subdomain to a specific port on a machine.
Now, restart apache2 by doing
Apache ProxyPass Docs
Configure the site
Example VirtualHost in/etc/apache2/sites-available:
<VirtualHost *:80>
DocumentRoot "/opt/dir/"
ServerName my.server.name
ServerAdmin support@mycompany.com
ProxyRequests On
ProxyPreserveHost On
ProxyVia full
<Proxy>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
You have to enable the site by linking/copying it from /etc/apache2/sites-available to /etc/apache2/sites-enabled or by using a2ensite (site).
Now, restart apache2 by doing
/etc/init.d/apache2 restart or service apache2 restart.
It doesn't work!
If you get this error and have apt:[warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
apt-get install libapache2-mod-proxy-html a2emnod proxy a2enmod proxy_html a2enmod proxy_http /etc/init.d/apache restartAlso
a2enmod any other protocols you might use. If you do not have a2enmod (Debian/Ubuntu), you can manually enable the modules by linking/copying them (*.load/*.conf) from /etc/apache2/mods-available to /etc/apache2/mods-enabled.
ERROR: Module proxy_html does not exist!
Runapt-get install libapache2-mod-proxy-html
To get a2ensite and a2enmod:
sudo apt-get install --reinstall apache2 apache2-commonApache ProxyPass Docs