Category Archives: Apache
So, I had a liferay server running on a Virtual Server on tomcat, then my boss announces that he’s not buying another server and I have to run PHP on it as well.
Fantastic APACHE comes to the rescue. Using virtual hosts it is not only possible to run PHP on a server but also forward domains off to a liferay server.
Ok all you have to do (it really is this simple), is to modify the https.conf file and restart apache.
Here’s some examples
1. Redirect to an external server
<VirtualHost 18.104.22.168:80> ServerName www.mydomainname.com ProxyPass / http://www.theotherdomainname.co.uk/ ProxyPassReverse / http://www.theotherdomainname.co.uk/ </VirtualHost>
(note this is NOT a redirect in fact but proxying the remote server – so you keep the same domain name! great!) BUT note that you could get the same effect by changing the A record on the domain in the DNS! But this is a great shortcut for placeholding until I have something to put there.
Proxying to a liferay server
<VirtualHost 22.214.171.124:80> ServerName www.liferayserver.com ProxyPass / http://126.96.36.199:8080/ ProxyPassReverse / http://188.8.131.52:8080/ </VirtualHost>
And finally running a local PHP/Apache combination
<VirtualHost 184.108.40.206:80> ServerName www.myphpserver.com DocumentRoot /var/www/ </VirtualHost>
220.127.116.11 = the servers IP (don’t think I’d give out a real IP !)
Don’t forget to restart your APACHE server after doing the changes