Skip to content

Instantly share code, notes, and snippets.

@vandorjw
Last active December 25, 2015 19:59
Show Gist options
  • Save vandorjw/7032025 to your computer and use it in GitHub Desktop.
Save vandorjw/7032025 to your computer and use it in GitHub Desktop.
Virtual Host Configuration file for Apache-2.4 and mod_wsgi
<VirtualHost *:80>
ServerName notes.vandorjw.me
Redirect permanent / https://notes.vandorjw.me
</VirtualHost>
<Virtualhost *:443>
ServerAdmin [email protected]
ServerName notes.vandorjw.me
# indexes + Directory Root, Mandatory but never used.
DirectoryIndex index.html
DocumentRoot /var/www/notes.vandorjw.me/htdocs
# Logfiles
Errorlog logs/notes.vandorjw.me/error.logs
Customlog logs/notes.vandorjw.me/access.log combined
#WSGI Settings (as daemon)
WSGIDaemonProcess notes-vandorjw display-name=%{GROUP} processes=4 threads=4 \
python-path=/var/www/notes.vandorjw.me/project:/var/virtualenvs/notes-vandorjw/lib/python2.7/site-packages
WSGIProcessGroup notes-vandorjw
WSGIScriptReloading On
WSGIScriptAlias / /var/www/notes.vandorjw.me/project/core/wsgi.py
<Directory /var/www/notes.vandorjw.me/project>
Options Indexes FollowSymLinks
Require all denied
AllowOverride none
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static /var/www/notes.vandorjw.me/static-collect
<Directory /var/www/notes.vandorjw.me/static-collect>
Options -Indexes
Require all granted
AllowOverride none
</Directory>
Alias /media /var/www/notes.vandorjw.me/media
<Directory /var/www/notes.vandorjw.me/media>
Options -Indexes
Require all granted
AllowOverride none
</Directory>
#SSL Directives - self-signed ssl cert
SSLEngine on
SSLCertificateFile /etc/httpd/certs.d/notes.vandorjw.me/server.crt
SSLCertificateKeyFile /etc/httpd/certs.d/notes.vandorjw.me/server.key
</Virtualhost>
@vandorjw
Copy link
Author

This will automatically and permanently redirect all request to the secure virtual host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment