FAQ

Page Discussion History

Difference between revisions of "Mailman"

(Nginx Config)
 
(Nginx Config)
Line 22: Line 22:
 
<geshi lang="nginx">
 
<geshi lang="nginx">
 
server {
 
server {
         server_name lists.DOMAIN.TLD;
+
         server_name DOMAIN.TLD;
         root /usr/lib/cgi-bin;
+
         root /usr/lib;
  
 
         location = / {
 
         location = / {
                 rewrite ^ /mailman/listinfo permanent;
+
                 rewrite ^ /cgi-bin/mailman/listinfo permanent;
 
         }
 
         }
  
 
         location / {
 
         location / {
                 rewrite ^ /mailman$uri;
+
                 rewrite ^ /cgi-bin/mailman$uri;
 
         }
 
         }
  
         # Some installations like to force cgi-bin/ in the url.
+
         location /mailman {
        location ~ ^/cgi-bin/mailman(/[^/]*)(/.*)?$ {
+
                rewrite ^ /cgi-bin$uri$args? permanent;
                proxy_set_header Host $host;
+
                proxy_pass http://127.0.0.1:8000;
+
 
         }
 
         }
  
         location ~ ^/mailman(/[^/]*)(/.*)?$ {
+
         location /cgi-bin/mailman {
                 proxy_set_header Host $host;
+
                 include fastcgi_params;
                 proxy_pass http://127.0.0.1:8000;
+
                 fastcgi_pass unix:/var/run/fcgiwrap.socket;
 
         }
 
         }
  

Revision as of 15:43, 11 January 2012

Contents

Mailman

Mailman is free software for managing electronic mail discussion and e-newsletter lists. Mailman is integrated with the web, making it easy for users to manage their accounts and for list owners to administer their lists. Mailman supports built-in archiving, automatic bounce processing, content filtering, digest delivery, spam filters, and more.

Apache has caused some extremely configurations to exist. Nginx tends to focus on simplicity. In the example below, I installed and configured mailman through the Ubuntu repositories.

Installation

To install mailman from the Ubuntu repository:

aptitude install mailman

From here, it's best to just follow the Mailman website. Configuration of mailman itself is a massive topic beyond the scope of this page.

Nginx Config

If the above is how you installed then the below will be nearly a drop in working model.

Nginx Config:

server {
        server_name DOMAIN.TLD;
        root /usr/lib;
 
        location = / {
                rewrite ^ /cgi-bin/mailman/listinfo permanent;
        }
 
        location / {
                rewrite ^ /cgi-bin/mailman$uri;
        }
 
        location /mailman {
                rewrite ^ /cgi-bin$uri$args? permanent;
        }
 
        location /cgi-bin/mailman {
                include fastcgi_params;
                fastcgi_pass unix:/var/run/fcgiwrap.socket;
        }
 
        location /images/mailman {
                alias /var/lib/mailman/icons;
        }
 
        location /pipermail {
                alias /var/lib/mailman/archives/public;
                autoindex on;
        }
}

CGI

In order for this to work you will need to have CGI processing available. There are a few guides to this but I "hopefully" took the pain out of it.

You will want to use either thttpd (recommended) or fcgiwrap.

To use thttpd-

/etc/thttpd/thttpd.conf:

port=8000
dir=/usr/lib/cgi-bin
nochroot
user=www-data
cgipat=/**
throttles=/etc/thttpd/throttle.conf
logfile=/var/log/thttpd.log


If using fcgiwrap, you will want your mailman location block to look like this:

        location ~ ^/mailman(/[^/]*)(/.*)?$ {
                fastcgi_split_path_info (^/mailman/[^/]*)(.*)$;
                include fastcgi_params;
                fastcgi_param GATEWAY_INTERFACE CGI/1.1;
                fastcgi_param SCRIPT_FILENAME $document_root$1;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_param PATH_TRANSLATED $document_root$2;
                fastcgi_pass unix:/tmp/cgi.sock;
        }

Look at the fcgiwrap page for help setting up that tool.

Credits

The seemingly simple setup above actually took a lot of work because of the files being spread across the operating system. For that reason, we need to add a little bit of credit. Thanks goes to Michael Lustfield (MTecknology) and Jon Kolb (kolbyjack).

Recent notes: Mailman with Nginx 1.0.4 on Ubuntu 10.04

The above configuration almost worked. Here are the things I changed to get my installation to run, some of which are needed and others of which are just cosmetic.

If you make root /usr/lib/cgi-bin as above, then in the Mailman config file mm_cfg.py you should change the default URL pattern and private archive URL like so:

DEFAULT_URL_PATTERN = 'http://%s/mailman/'
PRIVATE_ARCHIVE_URL = '/mailman/private'

Then your administration page URLs would skip cgi-bin, and would be accessed as, e.g. 'http://lists.DOMAIN.TLD/mailman/listinfo/<listname>'.

My final working 'location /mailman' section is given below. I went through many nonworking iterations, so I'm not sure which of the differences are significant except one related to the fastcgi parameters file, mentioned below.

        location /mailman {
                fastcgi_split_path_info ^(/mailman/[^/]*)(/.*)$;
                include mailman_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;
        }

I copied the distributed fastcgi_params file, then modified it by stripping out duplicates of those parameters set above, but I also removed the setting of REDIRECT_STATUS at the bottom, which should only be used with PHP. I think it was removing REDIRECT_STATUS that finally allowed my installation to work correctly.