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

About Paul C

I am a Senior Java programmer/Web Technologies, Play in a band called Mandolin Monday, I have a cat and I live on a boat.

Posted on May 9, 2012, in Apache, Liferay. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: