Skip to content

Instantly share code, notes, and snippets.

@amw
Created July 19, 2012 07:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amw/3141392 to your computer and use it in GitHub Desktop.
Save amw/3141392 to your computer and use it in GitHub Desktop.
Apache's Passenger virtual host config
<IfModule mod_passenger.c>
<VirtualHost 68.168.103.75:80>
DocumentRoot /rails/public
ServerName site.com
ServerAlias www.site.com
RackBaseURI /
XSendFile on
XSendFilePath /rails
#PassengerMinInstances 3
PassengerPreStart http://site.com
<LocationMatch !"^/assets">
PassengerHighPerformance On
</LocationMatch>
<LocationMatch "^/assets">
Header unset Last-Modified
Header unset ETag
FileETag None
ExpiresActive On
ExpiresDefault "access plus 1 years"
SetEnv no-gzip
RewriteEngine on
# Make sure the browser supports gzip encoding before we send it
RewriteCond %{HTTP:Accept-Encoding} \b(x-)?gzip\b
RewriteCond %{REQUEST_FILENAME}.gz -s
RewriteRule ^(.+) $1.gz [L]
Header append Vary: Accept-Encoding
</LocationMatch>
<FilesMatch \.css\.gz$>
ForceType text/css
Header set Content-Encoding gzip
</FilesMatch>
<FilesMatch \.js\.gz$>
ForceType text/javascript
Header set Content-Encoding gzip
</FilesMatch>
</VirtualHost>
<Directory /rails/public>
allow from all
Options FollowSymLinks
Options -MultiViews
</Directory>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment