FAQ

Page Discussion History

Difference between revisions of "Mailman"

(Nginx Config)
 
(Mailman)
 
(9 intermediate revisions by one user not shown)
Line 3: Line 3:
 
[http://www.gnu.org/software/mailman/index.html 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.
 
[http://www.gnu.org/software/mailman/index.html 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.
+
Mailman is crazy. This page used to focus on giving you options to install, configure, and run it as you wish. Because of the crazy that is mailman, this will show you the most common and best supported way to set up Mailman software behind Nginx.
  
 
== Installation ==
 
== Installation ==
Line 9: Line 9:
 
To install mailman from the Ubuntu repository:
 
To install mailman from the Ubuntu repository:
 
<geshi lang="bash">
 
<geshi lang="bash">
aptitude install mailman
+
aptitude install mailman thttpd
 
</geshi>
 
</geshi>
  
Line 22: Line 22:
 
<geshi lang="nginx">
 
<geshi lang="nginx">
 
server {
 
server {
 +
        listen XXX.XXX.XXX.XXX:80;
 
         server_name lists.DOMAIN.TLD;
 
         server_name lists.DOMAIN.TLD;
         root /usr/lib/cgi-bin;
+
         root /usr/lib;
  
 
         location = / {
 
         location = / {
Line 30: Line 31:
  
 
         location / {
 
         location / {
                 rewrite ^ /mailman$uri;
+
                 rewrite ^ /mailman$uri?$args;
 
         }
 
         }
  
        # Some installations like to force cgi-bin/ in the url.
+
         location = /mailman/ {
         location ~ ^/cgi-bin/mailman(/[^/]*)(/.*)?$ {
+
                 rewrite ^ /mailman/listinfo permanent;
                 proxy_set_header Host $host;
+
                proxy_pass http://127.0.0.1:8000;
+
 
         }
 
         }
  
         location ~ ^/mailman(/[^/]*)(/.*)?$ {
+
         location /mailman/ {
 +
                include proxy_params;
 +
                proxy_pass http://127.0.0.1/;
 
                 proxy_set_header Host $host;
 
                 proxy_set_header Host $host;
                 proxy_pass http://127.0.0.1:8000;
+
                 proxy_set_header X-Real-IP $remote_addr;
 +
        }
 +
 
 +
        location /cgi-bin {
 +
                rewrite ^/cgi-bin(.*)$ $1 permanent;
 
         }
 
         }
  
Line 59: Line 64:
 
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.
 
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.
+
Here, we're using thttpd. Edit the configuration file and make it match this exactly.
 
+
To use thttpd-
+
  
 
/etc/thttpd/thttpd.conf:
 
/etc/thttpd/thttpd.conf:
 
<geshi lang="text">
 
<geshi lang="text">
port=8000
+
host=127.0.0.1
dir=/usr/lib/cgi-bin
+
port=80
 +
dir=/usr/lib/cgi-bin/mailman
 
nochroot
 
nochroot
 
user=www-data
 
user=www-data
Line 74: Line 78:
 
</geshi>
 
</geshi>
  
 +
== Removing /cgi-bin/ from URL ==
  
If using [[fcgiwrap]], you will want your mailman location block to look like this:
+
Edit /usr/lib/mailman/Mailman/mm_cfg.py and change the following parameters.
 
+
<geshi lang="nginx">
+
        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;
+
        }
+
</geshi>
+
 
+
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:
+
 
+
 
<geshi lang="python">
 
<geshi lang="python">
 
DEFAULT_URL_PATTERN = 'http://%s/mailman/'
 
DEFAULT_URL_PATTERN = 'http://%s/mailman/'
Line 106: Line 86:
 
</geshi>
 
</geshi>
  
Then your administration page URLs would skip cgi-bin, and would be accessed as, e.g. 'http://lists.DOMAIN.TLD/mailman/listinfo/<listname>'.
+
== Sum It Up ==
  
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.
+
There's a lot to making mailman work. It's definitely not a simple clickety click process. If you follow the above to the letter, there's no reason you shouldn't wind up with a fully functioning mailman installation.
  
<geshi lang="nginx">
+
== Fixing Things ==
        location /mailman {
+
 
                fastcgi_split_path_info ^(/mailman/[^/]*)(/.*)$;
+
If you end up running into an issue where you have to authenticate for every link clicked in the admin interface, you may have changed the URI. This would happen if you are migrating from Apache or something else to Nginx. You can either try to match what you were using previously by manipulating the location blocks and thttpd config so the /mailman or the /cgi-bin/mailman will be passed to mailman. The other option is to run the command below.
                include mailman_fastcgi_params;
+
 
                fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
+
<geshi lang="bash">
                fastcgi_param PATH_INFO $fastcgi_path_info;
+
while read list stuff; do withlist -l -r fix_url "$list"; done < <(list_lists)
                fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
+
                fastcgi_intercept_errors on;
+
                fastcgi_pass unix:/var/run/fcgiwrap.socket;
+
        }
+
 
</geshi>
 
</geshi>
  
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.
+
This will clear that cache and let you access things normally again.

Latest revision as of 22:35, 17 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.

Mailman is crazy. This page used to focus on giving you options to install, configure, and run it as you wish. Because of the crazy that is mailman, this will show you the most common and best supported way to set up Mailman software behind Nginx.

Installation

To install mailman from the Ubuntu repository:

aptitude install mailman thttpd

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 {
        listen XXX.XXX.XXX.XXX: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;
        }
}

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.

Here, we're using thttpd. Edit the configuration file and make it match this exactly.

/etc/thttpd/thttpd.conf:

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

Removing /cgi-bin/ from URL

Edit /usr/lib/mailman/Mailman/mm_cfg.py and change the following parameters.

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

Sum It Up

There's a lot to making mailman work. It's definitely not a simple clickety click process. If you follow the above to the letter, there's no reason you shouldn't wind up with a fully functioning mailman installation.

Fixing Things

If you end up running into an issue where you have to authenticate for every link clicked in the admin interface, you may have changed the URI. This would happen if you are migrating from Apache or something else to Nginx. You can either try to match what you were using previously by manipulating the location blocks and thttpd config so the /mailman or the /cgi-bin/mailman will be passed to mailman. The other option is to run the command below.

while read list stuff; do withlist -l -r fix_url "$list"; done < <(list_lists)

This will clear that cache and let you access things normally again.