MailmanWiki

6.23. Mailman and nginx

This FAQ will try to illustrate how to setup Nginx ( http://nginx.net/) for Mailman support.

Since Nginx does not supports CGI, we need an additional web server for serving CGI scripts.

In this FAQ I use thttpd (http://www.acme.com/software/thttpd/).

First of all, lets configure thttpd so that it can serve the CGI scripts defined in our system (I'm using Debian Etch).

Edit the /etc/thttpd/thttpd.conf and set:

  port=8000
  # Make sure to disable chroot
  nochroot
  user=www-data
  host=127.0.0.1
  # Serve all the CGI on the system
  dir=/usr/lib/cgi-bin
  cgipat=/**

Note that, by default, thttpd will generate index pages for directories and you usually do not want this.

You can either recompile thttd, undefining the GENERATE_INDEXES macro in config.h, or you can chmod 711 the individual directories.

Restart thttpd with

  /etc/init.d/thttpd restart

Now lets configure nginx.

Create a new file in /etc/nginx/sites-available, as an example lists.domain.com, an create a symbolic link in /etc/nginx/sites-enabled to enable the new site.

This configuration assumes that a virtual server can be dedicated to Mailman.

   server {
       listen   80;
       server_name  lists.domain.com;

       access_log  /var/log/nginx/lists.domain.com.access.log;

       # Show in the main page the list info
       rewrite ^/$ /mailman/listinfo last;

       location /mailman/ {
           # Use thttpd for CGI
           proxy_pass http://127.0.0.1:8000/mailman/;

           proxy_set_header Host $host;
           #proxy_intercept_errors on;
       }

       location /images/mailman/ {
           alias   /var/lib/mailman/icons/;
       }

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

       #error_page  404  /404.html;

       # redirect server error pages to the static page /50x.html
       #
       error_page   500 502 503 504  /50x.html;
       location = /50x.html {
           root   /var/www/nginx-default;
      }
   }

NOTES: Nginx does not transfer, by default, the Server header from the proxied server response.

Moreover, if you enable proxy_intercept_errors, then all the errors from thttpd will be handled by nginx (but you need to create error pages, since a default nginx installation only has a custom 50x.html page).

This can be useful if you want to hide thttpd usage.

Last changed on Thu Nov 29 13:36:32 2007 by Manlio Perillo

7. What's new with Mailman 2.1?

Converted from the Mailman FAQ Wizard

This is one of many Frequently Asked Questions.

MailmanWiki: DOC/Mailman and nginx (last edited 2008-05-27 13:28:58 by terri)