Skip to content

Instantly share code, notes, and snippets.

@kogakure
Created July 11, 2010 05:47
Show Gist options
  • Select an option

  • Save kogakure/471316 to your computer and use it in GitHub Desktop.

Select an option

Save kogakure/471316 to your computer and use it in GitHub Desktop.
Apache: Webfaction Django Apache httpd.conf
ServerRoot "/home/user/webapps/django_project/apache2"
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule wsgi_module modules/mod_wsgi.so
KeepAlive Off
Listen 47902
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog logs/access_django_project.log combined
ErrorLog logs/error_django_project.log
StartServers 1
MinSpareServers 1
MaxSpareServers 3
MaxClients 50
ServerLimit 3
MaxRequestsPerChild 1000
SetEnvIf X-Forwarded-SSL on HTTPS=1
WSGIScriptAlias / /home/user/webapps/django_project/project.wsgi
<VirtualHost *:47902>
ServerName domain.de
ServerAlias www.domain.de
ServerAdmin [email protected]
RewriteEngine On
# Remove WWW
RewriteCond %{HTTP_HOST} !^domain\.de$
RewriteRule ^(.*)$ http://domain.de$1 [R=301,L]
# Append Slash
RewriteCond $1 !/$
RewriteCond %{REQUEST_URI} !^(/sitemap(.*)\.xml$|/googleeac5fa897a7f0f8d\.html$|/LiveSearchSiteAuth\.xml$|/y_key_dc7cb0ea15c5d3f2\.html$|/robots\.txt$|(.*)\.html$|(.*)\.htm$|(.*)\.js$|(.*)\.jpg$|(.*)\.png$|(.*)\.gif$|(.*)\.ico$)
RewriteRule (.+) http://domain.de$1/ [R=301,L]
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment