Here is my vhost file for using a multisite installation (default nowdays with Mephisto 0.8.1) being served by apache 2 and passenger. Don’t forget to a2ensite foo.com your domain, for apache to pick it up.


NameVirtualHost *:80

<VirtualHost *:80>
 ServerName coderado.com 
 ServerAlias www.coderado.com
 RailsEnv production
 DirectorySlash Off

 DocumentRoot /var/apps/m8/public
 ErrorLog /var/apps/m8/log/apache.log
 CustomLog /var/apps/m8/log/access.log combined

 <Directory /var/apps/m8/public>
  Options FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
 </Directory>

 RailsAllowModRewrite on
 RewriteEngine On
 # Rewrite / to index.html

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

 RewriteCond %{REQUEST_URI} ^/$
 RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}/index.html -f
 RewriteRule ^/(.*)$ /cache/%{HTTP_HOST}/index.html [QSA,L]

 RewriteCond %{REQUEST_URI} ^/[^.]+$
 RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}%{REQUEST_FILENAME}.html -f
 RewriteRule ^/(.*)$ /cache/%{HTTP_HOST}%{REQUEST_FILENAME}.html [QSA,L]

 RewriteCond %{REQUEST_URI} ^/.+$
 RewriteCond %{DOCUMENT_ROOT}/cache/%{HTTP_HOST}%{REQUEST_FILENAME} -f
 RewriteRule ^/(.*)$ /cache/%{HTTP_HOST}%{REQUEST_FILENAME} [QSA,L]

</VirtualHost>

Sorry, comments are closed for this article.