<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.2.2">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#ffffff">
Hey,<BR>
<BR>
Someone emailed me asking to clarify deployment... I wrote a large response, so I figured I may as well share it to the list, if anyone else had the same question:<BR>
<BR>
<BR>
If all you have is shared hosting... tough luck: Although it's possible to run Mojolicious apps as CGI scripts (http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Apache-CG ), it's by far less than ideal<A HREF="http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#Apache-CGI),">,</A> since you'll be starting your app up for each request—and that's slow.<BR>
<BR>
The proper way to do it is to have your Mojolicious app run continuously. That's usually a problem on shared hosts, because the system will kill any process that runs too long (1and1 shared hosting kills them after about 30 seconds of run time, for example).<BR>
<BR>
What you could do (and how I did it) is get a VPS from Linode (<A HREF="https://www.linode.com/">https://www.linode.com/</A> ). It's just $10/month, so the cost is comparable to shared hosting.<BR>
<BR>
What that gives you is essentially your own server. You can install anything you want on it. On mine, I installed Debian Linux, along with Apache.<BR>
<BR>
Then, I saved this file in /etc/apache2/sites-available/, named xtatik.org.conf<BR>
<BR>
<FONT COLOR="#808080">  <VirtualHost *:80></FONT><BR>
<FONT COLOR="#808080">    ServerName xtatik.org</FONT><BR>
<FONT COLOR="#808080">    <Proxy *></FONT><BR>
<FONT COLOR="#808080">      Order deny,allow</FONT><BR>
<FONT COLOR="#808080">      Allow from all</FONT><BR>
<FONT COLOR="#808080">    </Proxy></FONT><BR>
<FONT COLOR="#808080">    ProxyRequests Off</FONT><BR>
<FONT COLOR="#808080">    ProxyPreserveHost On</FONT><BR>
<FONT COLOR="#808080">    ProxyPass / http://localhost:8081/ keepalive=On</FONT><BR>
<FONT COLOR="#808080">    ProxyPassReverse / http://localhost:8081/</FONT><BR>
<FONT COLOR="#808080">    RequestHeader set X-Forwarded-Proto "http"</FONT><BR>
<FONT COLOR="#808080">  </VirtualHost></FONT><BR>
<BR>
Notice the "8081" port number; that's the port my Mojolicious app is listening on. Then I just enable that site in Apache (a2ensite xtatik.org) and restart the server(apache2ctl restart) and now Apache will forward any requests for "xtatik.org" to my Mojolicious app.<BR>
<BR>
Now, in my app, I configure Hypnotoad to serve on port 8081 as well (replace "$self", the Mojolicious::Controller, with "app" for ::Lite apps):<BR>
<BR>
<FONT COLOR="#808080">  $self->config(hypnotoad => {listen => ['http://*:8081']});</FONT><BR>
<BR>
At this point, you can simply run:<BR>
        <BR>
<FONT COLOR="#808080">  hypnotoad YourApp.pl</FONT><BR>
<BR>
And hypnotoad will start up your app, and visiting xtatik.org would now show the content generated by my app.... but, you don't wanna do that manually every time your server reboots, so what you can do is use Toadfarm (<A HREF="https://metacpan.org/pod/Toadfarm">https://metacpan.org/pod/Toadfarm</A> ) to start up all of your apps.<BR>
<BR>
And just to note: if you have only a single app, nothing's stopping you from foregoing Apache and just telling hypnotoad to listen on port :80 (or :443 for HTTPS). Many people also use nginx server instead of Apache due to lower resource requirements, but I was already familiar with Apache, so I went with that.<BR>
<BR>
Hope that helps! :)<BR>
<BR>
Cheers,<BR>
ZZ
</BODY>
</HTML>