nginx and gunicornΒΆ

As mentioned several times, you should create a dedicated user for RDMO. All steps for the installation, which do not need root access, should be done using this user. Here we assume this user is called rdmo and it’s home is /srv/rdmo and therefore your rdmo-app is located in /srv/rdmo/rdmo-app.

First install gunicorn inside your virtual environment:

pip install -r requirements/gunicorn.txt

Then, test gunicorn using:

gunicorn --bind config.wsgi:application

This should serve the application like runserver, but without the static assets, like CSS files and images. After the test kill the gunicorn process again.

Now, create a systemd service file for RDMO. Systemd will launch the gunicorn process on startup and keep running. Create a new file in /etc/systemd/system/rdmo.service and enter (you will need root/sudo permissions for that):

Description=RDMO gunicorn daemon

ExecStart=/srv/rdmo/rdmo-app/env/bin/gunicorn --bind unix:/srv/rdmo/rdmo.sock config.wsgi:application


This service needs to be started and enables like any other service:

sudo systemctl start rdmo
sudo systemctl enable rdmo

Next, install nginx

sudo apt install nginx  # on Debian/Ubuntu
sudo yum install nginx  # on RHEL/CentOS

Edit the nginx configuration as follows (again with root/sudo permissions):

# in /etc/nginx/sites-available/default  on Debian/Ubuntu
# in /etc/nginx/conf.d/vhost.conf        on RHEL/CentOS
server {
    listen 80;
    server_name YOURDOMAIN;

    location / {
        proxy_pass http://unix:/srv/rdmo/rdmo.sock;
    location /static/ {
        alias /srv/rdmo/rdmo-app/static_root/;

Restart nginx. RDMO should now be available on YOURDOMAIN. Note that the unix socket /srv/rdmo/rdmo.sock needs to be accessible by nginx.

As you can see from the virtual host configurations, the static assets, like CSS and JavaScript files are served independent from the reverse proxy to the gunicorn process. In order to do so they need to be gathered in the static_root directory. This can be archived by running:

python collectstatic

in your virtual environment.

In order to apply changes to the RDMO code (e.g. after an upgrade) the gunicorn process need to be restarted:

sudo systemctl restart rdmo