Skip to content

Instantly share code, notes, and snippets.

@palawer
Created February 11, 2016 19:27
Show Gist options
  • Save palawer/e30be40bea7ad66b10d6 to your computer and use it in GitHub Desktop.
Save palawer/e30be40bea7ad66b10d6 to your computer and use it in GitHub Desktop.
Apache + Django config
WSGIPythonPath /var/www/domain.com/project
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/domain.com/project/
WSGIScriptAlias / /var/www/domain.com/project/project/wsgi.py
#WSGIPythonPath /var/www/domain.com/project
Alias /static /var/www/domain.com/project/static
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [R=301,L]
<Directory /var/www/domain.com/project/static>
Options -Indexes
Require all granted
</Directory>
<Directory /var/www/domain.com/project/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment