Mailman with Postfix and Nginx on CentOS 6

Fri, Feb 24, 2012 2-minute read

In this tutorial I will show you how to set up Mailman with Postfix and Nginx on CentOS 6. I assume you have already set up Nginx to server CGI scripts using fcgiwrap like I’ve shown you in the previous post.

Here is the link:

I also presuppose that you have a working Postfix configuration.


The first step is to install Mailman.

yum install mailman

Next you have to edit your /usr/lib/mailman/Mailman/ and change the DEFAULT_URL_PATTERN.

DEFAULT_URL_PATTERN = 'http://%s/mailman/cgi-bin/'

This is the same hierarchy as in the directory at /usr/lib.

Next download this script:

Extract the into the folder /usr/lib/mailman/bin/.



As a next step, you’ll have to create a Nginx configuration.

vim /etc/nginx/conf.d/lists.example.conf

Add the following lines and adjust you domain:

server {
    server_name;                   # your domain name

        location /mailman/cgi-bin {
               root /usr/lib;
               fastcgi_split_path_info (^/mailman/cgi-bin/[^/]*)(.*)$;
               include /etc/nginx/fastcgi_params;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
               fastcgi_param PATH_INFO $fastcgi_path_info;
               fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
               fastcgi_intercept_errors on;
               fastcgi_pass unix:/var/run/fcgiwrap.socket;

        location /images/mailman {
               alias /usr/share/images/mailman;

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

That’s it for Nginx, don’t forget to restart it.


The last thing we have to take care of is the Postfix configuration.

postconf -e 'relay_domains ='
postconf -e 'mailman_destination_recipient_limit = 1'

Make sure your local IPv6 adress is at mydestinations = in your because mailman seems to use it for sending mails.

mydestinations =, [::1]/128


Next edit the file and add the following to the bottom:

mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list(i used mailman) argv=/usr/lib/mailman/bin/
  ${nexthop} ${user}

Now we need a transport map:

postconf -e 'transport_maps = hash:/etc/postfix/transport'

Edit the new transport file and add the following line: mailman:

After that:

postmap -v /etc/postfix/transport
service postfix restart

You’re nearly done, add the defaul mailing list called mailman:

/usr/lib/mailman/bin/newlist mailman

Edit your aliases file as told and execute newaliases and postfix restart.

Now you can do the same for any mailing list you want to create.

After that start Mailman and add it to chkconfig.

service mailman start
chkconfig -–levels 2345 mailman on

You can access the Mailman list page at


If you have any problems feel free to write a comment and I will try to help you asap. I’m not 100 percent sure if I’ve written everything necessary as I had to tweak around a lot to make it work.