Skip to content

Instantly share code, notes, and snippets.

@krzysztofjeziorny
Created November 27, 2018 09:22
Show Gist options
  • Save krzysztofjeziorny/c9ad22d4e9a91922ec47cda88c101ca2 to your computer and use it in GitHub Desktop.
Save krzysztofjeziorny/c9ad22d4e9a91922ec47cda88c101ca2 to your computer and use it in GitHub Desktop.
A sample Apache vHost configuration file for a Django/Wagtail project
# A sample Apache vHost configuration file
# Source: http://grimnes.no/blog/how-easily-deploy-wagtail-website/
<VirtualHost *:80>
ServerName www.example.com # your domain name
ServerAlias example.com *.example.com
Define project_name some_project_name #
Define user the_username # who owns the project? /home/the_username/..
Define project_path /... # Absolute path to the directory containing manage.py
Define wsgi_path /... # Absolute path to the directory containing wsgi.py
Define environment_path /... # Absolute path to the virtual python environment
WSGIDaemonProcess ${user}-${project_name} user=${user} group=${user} processes=1 threads=1 python-eggs=/tmp/python-eggs/ python-path=${project_path}:${environment_path}/lib/python2.7/site-packages
WSGIProcessGroup ${user}-${project_name}
WSGIScriptAlias / ${wsgi_path}/wsgi.py
<Directory ${project_path}>
Require all granted
</Directory>
Alias /static ${project_path}/static
<Directory ${project_path}/static>
Require all granted
SetHandler None
FileETag none
Options FollowSymLinks
</Directory>
Alias /media ${project_path}/media
<Directory ${project_path}/media>
Require all granted
SetHandler None
FileETag none
Options FollowSymLinks
ErrorDocument 404 /error404
</Directory>
ErrorLog /var/log/apache2/${user}-${project_name}-error.log
LogLevel info
CustomLog /var/log/apache2/${user}-${project_name}-access.log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment