Mailman with nginx and thttpd

David Newman dnewman at networktest.com
Tue Oct 26 04:02:53 MSD 2010


Greetings. I'm getting 404 errors after installing the Mailman mailing
list manager on a server running nginx and thttpd, and could use some
help in understanding why.

This is on "Mailserver", an excellent OpenBSD-based mail appliance from
Allard Consulting that uses nginx. I've pasted the current nginx and
thttpd configs below; the configs are based on Manlio Perillo's howto here:

http://wiki.list.org/display/DOC/Mailman+and+nginx

In my setup, the hostname is mail.suctest.com. I've created a separate
virtual host in nginx called 'lists.suctest.com' for the Mailman stuff.

The logs say requests to Mailman URLs such as this one:

http://lists.suctest.com/mailman/listinfo

produce 404 errors in both nginx and thttpd, although it's the latter
server that returns the error page. The Mailman stuff is in
/usr/local/mailman and is group readable by mailman.

Thanks in advance for clues on answering these two questions:

1. How to point nginx and thttp at the correct locations so that I'm not
getting 404s?

2. If possible, how to run Mailman under the canonical hostname of
'mail.suctest.com' instead of the separate name of 'lists.suctest.com'?

Thanks again

dn

-----

nginx.conf:

user _nginx;
worker_processes  2;
pid        /var/run/nginx.pid;
error_log  /var/log/httpd.err error;

events {
    worker_connections  1024;
}

http {
  include       mime.types;
  default_type  application/octet-stream;
  access_log  /var/log/httpd.log combined;

  sendfile       on;
  tcp_nopush     on;
  keepalive_timeout  65;
  server_name_in_redirect off;

  client_max_body_size 30M;
  client_body_buffer_size 512k;

  gzip  on;
  gzip_vary on;
  gzip_comp_level 9;
  gzip_min_length 0;
  gzip_proxied any;
  gzip_disable     "MSIE [1-6]\.";
  gzip_types text/plain text/css application/json
application/x-javascript text/xml application/xml application/xml+rss
text/javascript application/javascript;
  gzip_buffers 16 8k;

  ssl_protocols SSLv3 TLSv1;
  ssl_ciphers HIGH:!ADH:!MD5;
  ssl_prefer_server_ciphers   on;
  ssl_session_cache shared:SSL:1m;
  ssl_certificate      /etc/ssl/server.crt;
  ssl_certificate_key  /etc/ssl/private/server.key;

  upstream admin_mongrels {
    server 127.0.0.1:4213;
  }
  upstream account_mongrels {
    server 127.0.0.1:4214;
  }

  server {
    listen 4200;
    ssl on;
    root   /var/www/admin/public;

    location ~* \.(ico|css|js|gif|jp?g|png) {
      access_log off;
      expires 7d;
      break;
    }

    location / {
      proxy_redirect   off;
      proxy_set_header Host              $host:4200;
      proxy_set_header X-Real-IP         $remote_addr;
      proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
      proxy_set_header X_Forwarded_Proto $scheme;

      if (!-f $request_filename.html) {
        proxy_pass  http://admin_mongrels;
      }
    }
  }


  server {
    listen 80;
    location / {
      rewrite /(.*) https://$host/$1 redirect;
    }
  }

  server {
    listen 443;
    ssl    on;
    root /var/www/user;

    index  index.html index.htm index.php;

    location ~ .php$ {
      fastcgi_pass   unix:/tmp/php.sock;
      fastcgi_index  index.php;
      include        fastcgi_params;
      fastcgi_param  HTTPS on;
      fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }

    location ^~ /account/stylesheets {
      alias /var/www/user/account/public/stylesheets;
    }

    location ^~ /account/javascripts {
      alias /var/www/user/account/public/javascripts;
    }

    location ^~ /account/images {
      alias /var/www/user/account/public/images;
    }

    location ~* \.(ico|css|js|gif|jp?g|png) {
      access_log off;
      expires 7d;
      break;
    }

    location /account {
      proxy_redirect    off;
      proxy_set_header  Host             $host;
      proxy_set_header  X-Real-IP        $remote_addr;
      proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
      proxy_set_header  Port             $proxy_port;

      if (!-f $request_filename.html) {
        proxy_pass  http://account_mongrels;
      }
    }

  }

  server {
    listen 80;
    server_name lists.suctest.com;
    root /var/log/mailman;
    access_log /var/log/lists.suctest.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 lists.suctest.com;
      #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/nginx/html;
    }
  }

}

-----

thttpd.conf:

root at mail:log# cat /etc/thttpd/thttpd.conf

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



More information about the nginx mailing list