Nginx + uWSGI¶
uWSGI¶
Before you begin, it is adviced you read over the following uWSGI article on setting up Django with uWSGI and Nginx
If you haven’t already, make sure you’ve set up Static Files.
Configuration¶
First you will want to install uWSGI to the virtualenv which is easily done with the following commands:
$ source /opt/ganeti_webmgr/bin/activate
$ pip install uwsgi
Once uWSGI is installed you should configure Nginx to handle serving our static assets and proxy the rest to uWSGI. This assumes you’ve already collected static files to the default location. Here is a sample nginx virtual host:
upstream gwm {
# server unix:///path/to/gwm_uwsgi.sock; # for a file socket
server 127.0.0.1:8001;
}
server {
listen 80;
server_name gwm.example.org;
location /static {
alias /opt/ganeti_webmgr/collected_static;
}
location / {
uwsgi_pass gwm;
include uwsgi_params;
}
}
Finally you will want to configure uWSGI. Here is a sample uWSGI configuration file that should properly work with GWM:
# gwm_uwsgi.ini
[uwsgi]
# GWM's wsgi file
module = ganeti_webmgr.ganeti_web.wsgi
# the virtualenv (full path)
home = /opt/ganeti_webmgr
# Configure based on needs
master = true
processes = 2
socket = 127.0.0.1:8001
vacuum = true
To start uwsgi you can run the following command, pointing it at your uwsgi file:
$ uwsgi --ini /path/to/gwm_uwsgi.ini