Skip to content
kberov edited this page Dec 21, 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.

Apache/Shared Hosting

We have a discussion on the mailinglist about setting up mojo in shared environments.

https://groups.google.com/group/mojolicious/browse_thread/thread/6f17653fe30ab884

Clone this wiki locally