Apache as a front-end proxy to a Play! Application on Ubuntu

Here are some instructions to get a Play Application working with Apache2 as a proxy.
I am using Ubuntu 10.04 and assume that Apache has already been installed.

Create a file that contains the name of your virtual host at “/etc/apache/sites-enabled”.
To easily distinguish it, name it after your domain name. Ex. mysite

The contents of this file should be similar the following:

<VirtualHost *:80>
        ProxyPreserveHost On
        ProxyPass /
        ProxyPassReverse /
        ServerAdmin admin@mysite.com
        ServerName mysite.com
        ServerAlias www.mysite.com

        <Location />
          Order allow,deny
          Allow from all

        ErrorLog /var/log/apache2/mysite-error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/mysite-access.log combined

To use the setting you must have the correct modules loaded by Apache. The ones you need are proxy and proxy_http.

Enable these by running

a2enmod proxy
a2enmod proxy_http

To enable your new site you should run

a2ensite mysite

This entry was posted in Apache, Play framework. Bookmark the permalink.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s