In this part, we are adding nginx and wsgi servers so we can access CKAN from network.

First, install required packages

sudo pkgin in nginx

Now, copy provided wsgi script to config folder

cp /opt/ckan/default/src/ckan/ /opt/ckan/etc

Install wsgi and copy provided wsgi config file

sudo pkgin in py36-uwsgi
cp /opt/ckan/default/src/ckan/ckan-uwsgi.ini /opt/ckan/etc

Edit ckan-uwsgi.ini to match file paths.

Now you can run uwsgi server and check for errors

CKAN_INI=/opt/ckan/etc/ckan.ini /opt/local/bin/uwsgi -i /opt/ckan/etc/ckan-uwsgi.ini

If there are no error, continue to next step.

Create new site configuration in nginx with following contents

proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache:30m max_size=250m;
proxy_temp_path /tmp/nginx_proxy 1 2;

server {
    client_max_body_size 100M;
    location / {
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_cache cache;
        proxy_cache_bypass $cookie_auth_tkt;
        proxy_no_cache $cookie_auth_tkt;
        proxy_cache_valid 30m;
        proxy_cache_key $host$scheme$proxy_host$request_uri;
        # In emergency comment out line to force caching
        # proxy_ignore_headers X-Accel-Expires Expires Cache-Control;



Above configuration uses HTTP for communication between Nginx and uwsgi, but uwsgi has it’s own protocol for communication which Nginx supports. If you want to use it, first edit /opt/ckan/etc/ckan-uwsgi.ini and in third line change “http” to “socket”. Site configuration for Nginx is little simpler

    server {
        client_max_body_size 100M;
        location / {
            include uwsgi_params;

TODO: Check does this uses caching…

Restart Ngnix and try to access CKAN from network.