Skip to content
datamuc edited this page Dec 2, 2010 · 34 revisions

Apache deployment

Apache/mod_proxy

If you want to deploy multiple applications, it is easy to use virtual-host and mod_proxy in Apache.

<VirtualHost *:80>

   ServerName app1.somehost.com
   ProxyPass / http://localhost:3000/
   ProxyPassReverse / http://localhost:3000/

    </VirtualHost>

    <VirtualHost *:80>

   ServerName app2.somehost.com
   ProxyPass / http://localhost:3001/
   ProxyPassReverse / http://localhost:3001/

    </VirtualHost>

Note that you must create subdomains for each applications.

Apache/CGI

To make Mojolicious application run in CGI mode under Apache make sure your .htaccess file looks like following:

AddHandler cgi-script .cgi
Options +ExecCGI

IndexIgnore *

RewriteEngine on

RewriteCond %{DOCUMENT_ROOT}/public/%{REQUEST_URI} -f
RewriteRule ^(.*) public/$1 [L]

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} !-f
RewriteRule ^(.*) myapp.cgi [L] 

In this way you make Apache render static files from /public folder for you.

Clone this wiki locally