How to Install GNU Mailman on Ubuntu 16.04 with Postfix, Nginx and FastCGI

GNU mailman is free and open-source web-based mailing list manager written in Python. It’s commonly used by open-source projects. In this tutorial, we are going to install GNU mailman on Ubuntu 16.04 with Nginx and FastCGI.


Mailman only provides a web administration interface. It does not send or receive emails by itself but relies on external SMTP server such as Postfix.

It’s assumed that you already have Postfix properly installed. If not, check out the following tutorial.

With that out of the way, let’s get started with installing GNU Mailman.

Step 1: Install GNU Mailman

We can install GNU Mailman from repository.

sudo apt update

sudo apt install mailman

During the installation, you will be asked to select languages for Mailman. Use arrow key to move up and down. Use space bar to select your language. A star character indicates the language is selected.

After that, it prompts you to create a new list. Hit OK, then run the following command to create the mailman list.

sudo newlist mailman

Enter the list admin email address and set a password. Then edit /etc/aliases file.

sudo nano /etc/aliases

Copy and paste the following lines into the file.

## 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"

Save and close the file. Run the following command to update the alias index file.

sudo newaliases

Restart Postfix SMTP server.

sudo systemctl restart postfix

Start the Mailman program.

sudo systemctl start mailman

Step 2: Install FCGIWrap

To properly display the Mailman web interface, we need to install fcgiwrap package which allow us to run CGI applications with FastCGI and Nginx.

sudo apt install fcgiwrap

Once installed, fcgiwrap will run automatically, as can seen by issuing this command:

systemctl status fcgiwrap


● fcgiwrap.service - Simple CGI Server
   Loaded: loaded (/lib/systemd/system/fcgiwrap.service; indirect; vendor preset: enabled)
   Active: active (running) since Mon 2016-12-12 01:25:20 EST; 4min 27s ago
 Main PID: 27780 (fcgiwrap)
   CGroup: /system.slice/fcgiwrap.service
           └─27780 /usr/sbin/fcgiwrap -f

We need to make sure FCGI and Nginx run as the same user (www-data). Edit the  /etc/init.d/fcgiwrap shell script.

sudo nano /etc/init.d/fcgiwrap

Find the FCGI_USER and FCGI_GROUP variables. The value should be www-data. If not, change it.


After that, restart fcgiwrap service.

sudo systemctl restart fcgiwrap

fcgiwrap service listens on /var/run/fcigwrap.socket by default.

Step 3: Setting up Nginx Server Block

Install Nginx with:

sudo apt install nginx

To access Mailman from a sub-directory of your existing website, edit the server block file of your website.

sudo nano /etc/nginx/conf.d/your-site.conf

Put the following lines in the server section.

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_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;

Save and close the file. Then test Nginx configuration and reload.

sudo nginx -t

sudo systemctl reload nginx

Now you can access Mailman admin page via the following URL and create new mailing lists.

gnu mailman

That’s it!

I hope this article helped you  install GNU Mailman with Nginx on Ubuntu 16.04. As always, if you found this post useful, then subscribe to our free newsletter. You can also follow us on Google+ Twitter or like our Facebook page.

Rate this tutorial
[Total: 3 Average: 4]

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here