Deploy an application with FastCGI
Files
Extract your scaffolding on server. Take care that files are readable by apache user (www-data on debian), and writable if needed (such as your sqlite database).
Apache virtualhost config
in /etc/apache/conf.d/vhost.conf
NameVirtualHost xxx.yyy.zzz.aaa:80
# not allow in virtualhost ! (but as many FastCgiServer as you need)
FastCgiServer /var/www/TestApp/bin/jifty -initial-env JIFTY_COMMAND=fastcgi -processes 3
<VirtualHost test.jifty.org>
ServerName test.jifty.org
AddHandler fastcgi-script fcgi
DocumentRoot /var/www/TestApp/share/web/templates
ScriptAlias / /var/www/TestApp/bin/jifty/
<Directory /var/www/TestApp/bin/>
SetHandler fastcgi-script
Options +ExecCGI
</Directory>
CustomLog /var/www/TestApp/log/access_log combined
ErrorLog /var/www/TestApp/log/error_log
</VirtualHost>
FastCgiServer /var/www/TestApp2/bin/jifty -initial-env JIFTY_COMMAND=fastcgi -processes 3
<VirtualHost test2.jifty.org>
ServerName test2.jifty.org
AddHandler fastcgi-script fcgi
DocumentRoot /var/www/TestApp2/share/web/templates
ScriptAlias / /var/www/TestApp/bin2/jifty/
....
With fcgid
One can also use mod_fcgid with Apache2, which is an alternative FastCGI implementation. Here's a minimum configuration (/App is the path to your app) that can be optionally put inside a VirtualHost section:
DocumentRoot /App/share/web/templates
ScriptAlias / /App/bin/jifty/
DefaultInitEnv JIFTY_COMMAND fastcgi
<Directory /App/share/web/templates>
Options -Includes -ExecCGI
</Directory>
<Directory /App/bin>
Options +FollowSymLinks +ExecCGI
SetHandler fcgid-script
</Directory>
Fine-tune your "/static"
At some point you would like to let Apache to server all static files instead of letting it pass through fastcgi handler. This can lead to big performance win. You'll need some mod_rewrite rules to do this.
DocumentRoot /App/share/web/templates
ScriptAlias /cgi-bin /App/bin
DefaultInitEnv JIFTY_COMMAND fastcgi
RewriteEngine on
Alias /static2 /usr/local/share/perl/5.8.8/auto/Jifty/web/static
Alias /static /App/share/web/static
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule /static/(.*) /static2/$1 [PT,L]
RewriteRule ^(.*)$ /cgi-bin/jifty/$1 [PT,QSA,L]
<Directory /App/bin/>
Options +FollowSymLinks +ExecCGI
SetHandler fcgid-script
</Directory>
This configuration add an "/static2" URL that's an alias to Jifty internal static files, and use rewrite to conditionally pass through the request to there if the requested file does not exists under your static directory. You'll need to find the correct installation path of those internal static files. Usually, it looks like $SITE_LIB/auto/Jifty/web/static. SITE_LIB can be very different on different OS.
As your project grows bigger, it will be more ideal to move all static files to a CDN host instead.
Compress the output
In Apache2, you can append this piece of configuration to your site config so the HTML coming from jifty fastcgi server will be gzipped by Apache2 then served to browsers.
# Requires mod_defalte. Gzip the output of HTML for better front-end performance.
<Location />
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</Location>