Skip to content

Instantly share code, notes, and snippets.

@djheru
Created September 25, 2013 13:13
Show Gist options
  • Save djheru/6699402 to your computer and use it in GitHub Desktop.
Save djheru/6699402 to your computer and use it in GitHub Desktop.
Apache configuration for mod_wsgi
<VirtualHost *>
ServerName hostname.com
ServerAlias www.hostname.com
DocumentRoot /var/www/hostname.com/htdocs/
DirectoryIndex index.php index.html index.htm
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/hostname.com/htdocs/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /var/www/hostname.com/cgi-bin/
<Directory "/var/www/hostname.com/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
# The application WSGI Process Group Details
WSGIDaemonProcess app_wsgi processes=2 threads=1 display-name=%{GROUP} python-path=/usr/local/lib/virtualenvs/app/lib/python2.6/site-packages/
WSGIPassAuthorization On
WSGIScriptAlias /uci /opt/app/wsgi_server.py
WSGIProcessGroup app_wsgi
WSGIApplicationGroup %{GLOBAL}
ErrorLog /var/www/hostname.com/log/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/www/hostname.com/log/access.log combined
ServerSignature Off
# Rewrite Rules
RewriteEngine On
RewriteLogLevel 9
RewriteLog "/var/log/apache2/rewrite.log"
RewriteCond %{REQUEST_URI} ^/web
RewriteCond %{QUERY_STRING} ^queryparam=(.*)$
RewriteRule ^(.*)$ /app/queryparam/%1 [PT,L]
</VirtualHost>
<VirtualHost *>
ServerName www.hostname.com
RedirectPermanent / https://hostname.com/
ErrorLog /var/www/hostname.com/log/error.log
CustomLog /var/www/hostname.com/log/access.log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment