Category Archives: Apache

The WONDERFUL Apache Server

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 12.34.56.78: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 12.34.56.78:80>
ServerNameĀ www.liferayserver.com
ProxyPass / http://12.34.56.78:8080/
ProxyPassReverse / http://12.34.56.78:8080/
</VirtualHost>

And finally running a local PHP/Apache combination

<VirtualHost 12.34.56.78:80>
 ServerName www.myphpserver.com
 DocumentRoot /var/www/
</VirtualHost>

12.34.56.78 = 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

/etc/init.d/apache2 restart
Advertisements