Apache + mod_wsgi¶
Overview¶
Before beginning deploying Ganeti Web Manager using Apache, read the following Django article on deploying Django with apache and mod_wsgi.
If you haven’t already, make sure you’ve set up Static Files.
To get Ganeti Web Manager installed there are a few steps.
Install Apache
Configure/install
mod_wsgi
and other Apache modulesCreate the Ganeti Web Manager VirtualHost
Configuration¶
Make sure you have mod_wsgi installed and enabled in Apache before beginning.
Next you want to create a vhost which will contain the Apache settings that will
point to our Django app. The following is an example which assumes you have
installed Ganeti Web Manager to the default location in /opt/ganeti_webmgr
, and that your
running python 2.6. Replace the locations with where you’ve actually installed
it to, and replace python2.6 with the version of python you’re using.
The following is an example Apache configuration for Apache 2.4:
<VirtualHost *:80>
ServerName gwm.example.org
WSGIDaemonProcess ganeti_webmgr processes=4 threads=1 python-path=/opt/ganeti_webmgr/lib/python2.6/site-packages
WSGIProcessGroup ganeti_webmgr
WSGIScriptAlias / /opt/ganeti_webmgr/lib/python2.6/site-packages/ganeti_webmgr/ganeti_web/wsgi.py
Alias /static/ /opt/ganeti_webmgr/collected_static/
<Directory /opt/ganeti_webmgr/collected_static>
Require all granted
</Directory>
<Directory /opt/ganeti_webmgr>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
If you’re running an older version of Apache, Require all granted
isn’t
supported, so you’ll need to do the following:
<VirtualHost *:80>
ServerName gwm.example.org
WSGIDaemonProcess ganeti_webmgr processes=4 threads=1 python-path=/opt/ganeti_webmgr/lib/python2.6/site-packages
WSGIProcessGroup ganeti_webmgr
WSGIScriptAlias / /opt/ganeti_webmgr/lib/python2.6/site-packages/ganeti_webmgr/ganeti_web/wsgi.py
Alias /static/ /opt/ganeti_webmgr/collected_static/
<Directory /opt/ganeti_webmgr/collected_static>
Order deny,allow
Allow from all
</Directory>
<Directory /opt/ganeti_webmgr>
<Files wsgi.py>
Order allow,deny
Allow from all
</Files>
</Directory>
</VirtualHost>
WSGIDaemonProcess
:processes
should be set to the number of CPU cores available.threads
is fine to be left at 1.python-path
is adding our installation containing Ganeti Web Manager to thepythonpath so it, and all of the dependencies installed can be accessed by mod_wsgi.
More info on this particular directive can be found on the mod_wsgi docs.
WSGIScriptAlias
:This is the base URL path that Ganeti Web Manager will be served at. In this case its at
/
(the root url).Alias
:Defines where to find the static assets (css, js, images) for Ganeti Web Manager. This lets Apache serve the static files instead of having Django do it. You can leave this as is unless you modified the
STATIC_ROOT
setting in your config file.