Skip to content

Instantly share code, notes, and snippets.

@inlanger
Created September 25, 2013 16:00
Show Gist options
  • Save inlanger/6701831 to your computer and use it in GitHub Desktop.
Save inlanger/6701831 to your computer and use it in GitHub Desktop.
Apache virtualhost with gzip, expires and mod_wsgi django settings.
<VirtualHost *:80>
ServerAdmin webmaster@sitename.com
ServerName sitename.com
DocumentRoot /var/www/sitename.com
WSGIScriptAlias / /var/www/sitename.com/django.wsgi
ErrorLog /var/www/sitename.com/error.log
ExpiresActive on
ExpiresByType application/javascript "access plus 1 months"
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType image/jpg "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType font/ttf "access plus 1 months"
ExpiresByType text/css "access plus 1 months"
<IfModule mod_deflate.c>
<FilesMatch "\.(ttf|otf|eot|svg)$" >
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
Alias /media /var/www/sitename.com/media
Alias /static /var/www/sitename.com/static
Alias /robots.txt /var/www/sitename.com/static/robots.txt
<Location "/robots.txt">
SetHandler None
</Location>
<Location "/static/">
SetHandler None
</Location>
<Location "/media/">
SetHandler None
</Location>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment