server {
    listen 1.2.3.4:80;
    server_name lists.DOMAIN.TLD;
    root /usr/lib;

    location = / {
        rewrite ^ /mailman/listinfo permanent;
    }

    location / {
        rewrite ^ /mailman$uri?$args;
    }

    location = /mailman/ {
        rewrite ^ /mailman/listinfo permanent;
    }

    location /mailman/ {
        include proxy_params;
        proxy_pass http://127.0.0.1/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    location /cgi-bin {
        rewrite ^/cgi-bin(.*)$ $1 permanent;
    }

    location /images/mailman {
        alias /var/lib/mailman/icons;
    }

    location /pipermail {
        alias /var/lib/mailman/archives/public;
        autoindex on;
    }
}
