Running pd3f in Production with Nginx

An example config for Nginx to run in conjunction with

limit_req_zone $binary_remote_addr zone=limitfiles:10m rate=1r/s;
proxy_cache_path /var/nginx/cache keys_zone=pd3fcache:1m inactive=1m max_size=10M;

server {
    client_max_body_size 50M;

    if ($request_method !~ ^(GET|HEAD|POST)$ )
        return 405;

    # prevent guessing of file names
    location /files/ {
        limit_req zone=limitfiles burst=2 nodelay;
        alias /var/pd3f/pd3f-data-uploads/;
        add_header Content-disposition "attachment";

    location /update/ {

    # simple caching
    location / {
        proxy_cache pd3fcache;
        expires 10m;
        add_header Cache-Control "public";


    # restrict access to a IP / Subnet + protect with Basic Auth
    location /dashboard/ {
        allow xx.xx.xx.xx;
        deny all;

        auth_basic "Private Area";
        auth_basic_user_file /path/to/.htpasswd;


Make sure set to set the correct permission to let Nginx serve the static files (in /var/pd3f/pd3f-data-uploads/).

Common Problems

If there are problems with rq (the queue), just remove the image:

docker rm root_redis_1

This will clean all data in redis.