I haven’t posted a how-to in a while, so I figured since I just spent half a day installing mailman due to horrible documentation with nginx and mailman and suggestions to install thttpd instead. Here is the link to the Mailman I setup. So now onto the tutorial.

First your going to want to install Postfix and configure it.

$ sudo apt-get install postfix

Then your going to want to configure it:

$ sudo dpkg-reconfigure postfix

Insert the following details when asked (replacing example.com with your domain name if you have one):

  1. General type of mail configuration: Internet Site
  2. NONE doesn’t appear to be requested in current config
  3. System mail name: example.com (if you want an email like [email protected])
  4. Root and postmaster mail recipient:
  5. Other destinations for mail: example.com, localhost.example.com, localhost (And any other domains you want postfix to handle)
  6. Force synchronous updates on mail queue?: No
  7. Local networks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
  8. Yes doesn’t appear to be requested in current config
  9. Mailbox size limit (bytes): xxxx
  10. Local address extension character: +
  11. Internet protocols to use: all

Restart postix

$ sudo service postfix restart

Now were going to want to install fcgiwrap.

$ sudo apt-get install fcgiwrap

You may need to adjust /etc/init.d/fcgiwrap with the appropriate user and group of your nginx install.

$ sudo nano /etc/init.d/fcgiwrap
FCGI_USER="your nginx user"
FCGI_GROUP="www-data"
Restart fcgiwrap
$ sudo service fcgiwrap restart

Now onto Mailman.

First install Mailman (the two install instructions are self-explanatory and up to you)

$ sudo apt-get install mailman

Now we have to create a mailman list (the instructions again are self-explanatory and up to you).

$ sudo newlist mailman

Now we have to create aliases for the mail so edit /etc/aliases

$ sudo nano /etc/aliases

Add the following lines. (Your going to have to do this for every new list)

## mailman mailing list
mailman:              "|/var/lib/mailman/mail/mailman post mailman"
mailman-admin:        "|/var/lib/mailman/mail/mailman admin mailman"
mailman-bounces:      "|/var/lib/mailman/mail/mailman bounces mailman"
mailman-confirm:      "|/var/lib/mailman/mail/mailman confirm mailman"
mailman-join:         "|/var/lib/mailman/mail/mailman join mailman"
mailman-leave:        "|/var/lib/mailman/mail/mailman leave mailman"
mailman-owner:        "|/var/lib/mailman/mail/mailman owner mailman"
mailman-request:      "|/var/lib/mailman/mail/mailman request mailman"
mailman-subscribe:    "|/var/lib/mailman/mail/mailman subscribe mailman"
mailman-unsubscribe:  "|/var/lib/mailman/mail/mailman unsubscribe mailman"

Now we have to update the aliases.

$ sudo newaliases

And now restart postfix.

$ sudo service postfix restart

Now start up mailman

$ sudo service mailman start

Now onto the Nginx configuration, i’m assuming you already have a vhost setup if not go create one.

First we have to edit /etc/nginx/fastcgi_params

$ sudo nano /etc/nginx/fastcgi_params

put a comment ‘#’ in front of

fastcgi_param SCRIPT_FILENAME $request_filename;

so it will look like this:

#fastcgi_param SCRIPT_FILENAME $request_filename;

Now open up your vhost for this tutorial im refering to it as /etc/nginx/sites-available/example.com.conf

$ sudo nano /etc/nginx/sites-available/example.com.conf

Insert the following lines into your server block for whatever domain.

server {
[...]
        location /cgi-bin/mailman {
               root /usr/lib/;
               fastcgi_split_path_info (^/cgi-bin/mailman/[^/]*)(.*)$;
               include /etc/nginx/fastcgi_params;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
               fastcgi_param PATH_INFO $fastcgi_path_info;
               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;
        }
[...]
}

Restart nginx and your done!

$ sudo service nginx restart

Notes and FAQ:

  • If you want to remove /cgi-bin Your going to have to edit /var/lib/mailman/Mainman/mm_config.py and the nginx config.
  • If your having trouble with mail make sure your firewall isn’t blocking port 25. Example: $ sudo ufw allow 25/tcp