Saturday, October 2, 2010

Web App Navigation with Apache Aliases

Apache_software_foundation_logo_3074
This past week I installed ThinkUp, the open source creation by Gina Trapani, sponsored by Expert Labs and used by the White House to get statistics from various social networks like Twitter and Facebook.  The web application is very easy to install due to the nice web installer interface.  If you are interested in installing it yourself, you can follow the instructions here.

All the ThinkUp web app needed was to be dropped in a folder accessable from your website, given write access and have an empty mysql database and user to specify for the setup.  The easy way would be to create a folder in your root directory so you could access it by going to:

http://yourdomainname.com/webapp

In my case my Apache root is set to my StatusNet instance in my www root (ie. /var/www/statusnet) and I didn't want to place the ThinkUp app folder in my "statusnet" folder due to it messing with my upgrade workflow for StatusNet.

I opted to create a folder in my www root for Thinkup (/var/www/thinkupfolder) but since Apache's root was set to /var/www/statusnet, I needed to create a shortcut to this location. To do this I used an alias.  With your favorite editor edit:

/etc/apache2/sites-available/default

Add the following:

Alias /webapp /var/www/webapp/
<Directory /var/www/webapp>
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

You can visit Apache's site to learn how to restrict access and add other controls as well. Now you can keep your web apps separate but still access them from your domain root as a sub directory! ~Lou