# Do you know howto setup mailman+nginx+fcgiwrap+ubuntu/debian?, was: Bug in NginxHttpFcgiModule's fas

**URL:** <https://www.ruby-forum.com/t/do-you-know-howto-setup-mailman-nginx-fcgiwrap-ubuntu-debian-was-bug-in-nginxhttpfcgimodules-fas/198972>\
**Category:** NGINX\
**Created:** [November 11, 2010, 7:14pm UTC](https://www.ruby-forum.com/t/do-you-know-howto-setup-mailman-nginx-fcgiwrap-ubuntu-debian-was-bug-in-nginxhttpfcgimodules-fas/198972 "2010-11-11T19:14:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [November 11, 2010, 7:14pm UTC](https://www.ruby-forum.com/t/do-you-know-howto-setup-mailman-nginx-fcgiwrap-ubuntu-debian-was-bug-in-nginxhttpfcgimodules-fas/198972/1 "2010-11-11T19:14:05Z")

</div>

On Thu, 11 Nov 2010 05:35:46 +0300,removed\_email\_address@domain.invalid wrote:

> Hi there,

Hi Francis,  
I thank you for your attempt at trying to help me.

This problem reminds me of a similar one that was debated in this list  
a few months ago regarding Nginx config to serve Drupal.  
It was a mess (mostly because the Drupal way of doing things).  
And then Igor S. committed ‘try\_files’ to Nginx and  
things just got more manageable.

> At first glance, it looks to me as if nginx is doing exactly what you  
> told it to. I suspect that a small reconfiguration of mailman will work  
> for you.

Well, the truth is that Mailman works out of the box using Apache on  
Ubuntu/Debian Linux, using a config file  
named /etc/mailman/apache.conf, which includes these lines:  
ScriptAlias /cgi-bin/mailman/ /usr/lib/cgi-bin/mailman/  
Alias /pipermail/ /var/lib/mailman/archives/public/  
Alias /images/mailman/ /usr/share/images/mailman/

I have tried many changes to both my nginx config file and to mailman’s  
mm\_cfg.py.  
And, for instance, it almost does the job by just using:  
root /usr/lib/cgi-bin/mailman/;  
location = / {  
rewrite ^ /listinfo last;  
}  
location /cgi-bin/mailman/ {  
rewrite ^ /$args;  
}

But there are administrative areas that still do not work.

After an extensive search in the web, it seems that this same problem  
surfaces from time to time and those who ask for help, either stop  
using Nginx to serve Mailman, or just abandon the thread were they  
asked for help in the first place.

It must be possible, as Nginx’s own mailing lists are  
managed by Mailman (although under FreeBSD).  
But, as of Nov.2011, I have not found a single site with clear  
instructions on howto setup a fully working Mailman using Ubuntu/Debian

- Nginx + fcgiwrap (or any other cgi wrapper).

> To make things work for you, you could probably try a new “location  
> /cgi-bin/ {}” block which rewrites to the same url without the  
> “/cgi-bin” at the start.

I have already tried many combinations of that, but without  
achieving a _fully_ working setup.

> …remove the string “/cgi-bin” from two lines up there. (And you could  
> probably even remove the “/mailman” too.)

Done that too, but also without success.

> Your nginx is not configured to serve from the /cgi-bin urls, but is  
> from the others.

I agree, but having spent more than a few hours running in circles, I do  
not know what else to change.  
Sometimes Igor or Maxim just kick in and are able to sort it out.

> (Note: I haven’t tested any of this.)

But at least you tried to help and did take the time to share your  
ideas, and for that I thank you.

M.

---

<div class="post-metadata">

**Author:** ![larios](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/bc79bd/32.png) [@larios](https://www.ruby-forum.com/u/larios)\
**Post date:** [November 11, 2010, 7:23pm UTC](https://www.ruby-forum.com/t/do-you-know-howto-setup-mailman-nginx-fcgiwrap-ubuntu-debian-was-bug-in-nginxhttpfcgimodules-fas/198972/2 "2010-11-11T19:23:31Z")

</div>

On Thu, Nov 11, 2010 at 06:12:31PM +0000, Mark A. wrote:

> And then Igor S. committed ‘try\_files’ to Nginx and  
> Alias /pipermail/ /var/lib/mailman/archives/public/  
> rewrite ^ /$args;  
> managed by Mailman (although under FreeBSD).
> 
> Sometimes Igor or Maxim just kick in and are able to sort it out.
> 
> > (Note: I haven’t tested any of this.)
> 
> But at least you tried to help and did take the time to share your  
> ideas, and for that I thank you.

Please look this:

> **[Mailman with nginx and thttpd](http://mailman.nginx.org/pipermail/nginx/2010-October/023255.html)**

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![larios](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/bc79bd/32.png) [@larios](https://www.ruby-forum.com/u/larios)\
**Post date:** [November 12, 2010, 5:04pm UTC](https://www.ruby-forum.com/t/do-you-know-howto-setup-mailman-nginx-fcgiwrap-ubuntu-debian-was-bug-in-nginxhttpfcgimodules-fas/198972/3 "2010-11-12T17:04:07Z")

</div>

On Thu, Nov 11, 2010 at 06:12:31PM +0000, Mark A. wrote:

> On Thu, 11 Nov 2010 05:35:46 +0300,removed\_email\_address@domain.invalid wrote:

Hi there,

> I thank you for your attempt at trying to help me.

You’re welcome.

We can keep trying, if you’re happy to.

> Well, the truth is that Mailman works out of the box using Apache on  
> Ubuntu/Debian Linux, using a config file  
> named /etc/mailman/apache.conf, which includes these lines:  
> ScriptAlias /cgi-bin/mailman/ /usr/lib/cgi-bin/mailman/  
> Alias /pipermail/ /var/lib/mailman/archives/public/  
> Alias /images/mailman/ /usr/share/images/mailman/

As far as I can see, the debian configuration is not the same as the  
mailman-default configuration. So if you change the urls handled by the  
web server, you must also change the urls generated by mailman.

In the previous mail, it looks like the mailman and web server  
configurations were not synchronised.

> I have tried many changes to both my nginx config file and to mailman’s  
> mm\_cfg.py.

It looks like it would be best to decide what config you want, and then  
work to that. The wiki page you referenced,  
[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/Mailman),  
suggests to install from packages, and then configure according to the  
mailman web site. And then suggests an nginx configuration based on that  
mailman configuration, not the original configuration. I think.

At each stage, make one change for one reason, and see that it works  
as expected.

(I think it’s a slight shame that the wiki page doesn’t specify what  
versions of software were used in that recipe; and there also seem to  
be enough missing parts that it’s not really a recipe at all. “Configure  
mailman”, “add some cgi processor”. But this is a good chance for  
someone  
who wants to set it up, to note exactly what they did, so that the  
_next_  
person with the same problem has a harder-to-misunderstand recipe.)

For example:

> And, for instance, it almost does the job by just using:  
> root /usr/lib/cgi-bin/mailman/;  
> location = / {  
> rewrite ^ /listinfo last;  
> }  
> location /cgi-bin/mailman/ {  
> rewrite ^ /$args;  
> }

there, I’m not sure what urls you are expecting to have work. Ones that  
start with “/mailman”, or “/cgi-bin/mailman”, or “/cgi-bin”, or all of  
the above. mm\_cfg.py matters here too.

> But there are administrative areas that still do not work.

When you next have a looks-like-it-should-work configuration, and you  
see  
some oddities like this, please include the request made, the expected  
result, and the actual result – that should make it easier for someone  
to see what is happening.

> After an extensive search in the web, it seems that this same problem  
> surfaces from time to time and those who ask for help, either stop  
> using Nginx to serve Mailman, or just abandon the thread were they  
> asked for help in the first place.
> 
> It must be possible, as Nginx’s own mailing lists are  
> managed by Mailman (although under FreeBSD).

I don’t see any mention of “fastcgi” or “fcgi” or “fcgiwrap” when  
searching on the mailman wiki, [http://wiki.lists.org/](http://wiki.lists.org/). Maybe mailman  
doesn’t work under fastcgi at all? From the  
[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/Mailman)  
page, it presumably did work for whoever wrote it.

> But, as of Nov.2011, I have not found a single site with clear  
> instructions on howto setup a fully working Mailman using Ubuntu/Debian
> 
> - Nginx + fcgiwrap (or any other cgi wrapper).

As per Igor’s mail, there was a thread here a few weeks ago where  
someone was trying to proxy the cgi stuff to a cgi-enabled web server,  
and the configuration used by the nginx server. I didn’t see a follow-up  
saying either “that works for me”, or “still broken, here’s what I do,  
what I see, and what I expect to see, please help more”

> > …remove the string “/cgi-bin” from two lines up there.
> 
> Done that too, but also without success.

That looks to me like the most likely to succeed.

nginx.conf exactly as it was sent the last time, and the 8 characters  
“/cgi-bin” removed from two config lines in mm\_cfg.py. What requests  
do you make, and what responses do you see? (“curl -i” or “curl -v”  
can be very handy in finding out exactly what is going on, as can the  
nginx debug log.)

> > Your nginx is not configured to serve from the /cgi-bin urls, but is  
> > from the others.
> 
> I agree, but having spent more than a few hours running in circles, I do  
> not know what else to change.

I know it can get frustrating running in circles.

If Igor’s “proxy cgi, don’t try to force it to be fastcgi” configuration  
isn’t one you want to try, then I suggest to go back to the state when  
you sent the first mail, and adjust mm\_cfg.py.

Note: there is a recent mailman thread, ending at  
[http://www.mail-archive.com/removed\_email\_address@domain.invalid/msg57853.html](http://www.mail-archive.com/removed_email_address@domain.invalid/msg57853.html),  
which suggests that the mailman stuff was failing because the fastcgi  
system in that setup was not defining PATH\_INFO correctly.

After you’ve expunged the /cgi-bin urls, you may be able to see whether  
that problem affects your fastcgi setup (I don’t see explicit version  
numbers in that mailman thread).

Good luck with it,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![larios](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/bc79bd/32.png) [@larios](https://www.ruby-forum.com/u/larios)\
**Post date:** [November 15, 2010, 7:52pm UTC](https://www.ruby-forum.com/t/do-you-know-howto-setup-mailman-nginx-fcgiwrap-ubuntu-debian-was-bug-in-nginxhttpfcgimodules-fas/198972/4 "2010-11-15T19:52:02Z")

</div>

On Thu, 11 Nov 2010 21:22:08 +0300, Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Please look this:  
> [Mailman with nginx and thttpd](http://nginx.org/pipermail/nginx/2010-October/023255.html)

Problem solved. Thanks Igor.  
As usually, your hint just pointed me in the right  
direction.

I leave here the setup procedure:  
“Howto setup mailman 2.1.13, using nginx 0.8.53, thttpd 2.25b-11, over  
Ubuntu 10.10/debian”

# install & configure the thttpd cgi server

sudo apt-get install thttpd

# change /etc/default/thttpd to have ENABLED=yes

# change /etc/thttpd/thttpd.conf to have:

port=8000  
dir=/usr/lib/cgi-bin  
nochroot  
user=www-data  
cgipat=/\*\*  
throttles=/etc/thttpd/throttle.conf  
host=127.0.1.1  
logfile=/var/log/thttpd.log  
sudo /etc/init.d/thttpd restart # restart using new settings

# install & configure mailman

sudo apt-get install mailman  
sudo touch /usr/lib/cgi-bin/mailman/favicon.ico # fake a favicon

# create the mailman admin mailing list

sudo newlist -l en -q mailman [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) SOMEPWD

# must choose an MTA, even if it is MTA=None

sudo sed -i ‘s/._(MTA=None._)/\1/’ /etc/mailman/mm\_cfg.py  
#set mailman permissions  
sudo chown www-data /var/lib/mailman/archives/private  
sudo chmod o-x /var/lib/mailman/archives/private  
sudo /usr/sbin/check\_perms -f

# start mailman

sudo /etc/init.d/mailman start

# create a nginx cfg file

# create a file /etc/nginx/sites-available/mailman

# 

# use location /cgi-bin/mailman/ instead of /cgi-bin/ , otherwise

“(any list…) Administrator Authentication” will not work.

# 

server {  
listen 80;  
server\_name [mail.example.com](http://mail.example.com);  
access\_log /var/log/nginx/mailman.access.log;  
error\_log /var/log/nginx/mailman.error.log;  
root /usr/lib/cgi-bin/mailman;  
location = /mailman/ {  
proxy\_pass [http://127.0.1.1:8000/mailman/listinfo](http://127.0.1.1:8000/mailman/listinfo);  
proxy\_set\_header Host $host;  
}  
location /mailman/ {  
proxy\_pass [http://127.0.1.1:8000/mailman/](http://127.0.1.1:8000/mailman/);  
proxy\_set\_header Host $host;  
}  
location = /cgi-bin/mailman/ {  
proxy\_pass [http://127.0.1.1:8000/mailman/listinfo](http://127.0.1.1:8000/mailman/listinfo);  
proxy\_set\_header Host $host;  
}  
location /cgi-bin/mailman/ {  
proxy\_pass [http://127.0.1.1:8000/mailman/](http://127.0.1.1:8000/mailman/);  
proxy\_set\_header Host $host;  
}  
location /images/mailman {  
alias /var/lib/mailman/icons;  
}  
location /pipermail {  
alias /var/lib/mailman/archives/public;  
autoindex on;  
}  
}

sudo ln   
-svf /etc/nginx/sites-available/mailman /etc/nginx/sites-enabled/  
sudo /usr/sbin/nginx -s reload

Run mailman from: [http://mail.example.com/mailman](http://mail.example.com/mailman)

M.

---

<div class="post-metadata">

**Author:** ![larios](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/bc79bd/32.png) [@larios](https://www.ruby-forum.com/u/larios)\
**Post date:** [November 15, 2010, 7:54pm UTC](https://www.ruby-forum.com/t/do-you-know-howto-setup-mailman-nginx-fcgiwrap-ubuntu-debian-was-bug-in-nginxhttpfcgimodules-fas/198972/5 "2010-11-15T19:54:34Z")

</div>

On Fri, 12 Nov 2010 16:03:00 +0000, Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> We can keep trying, if you’re happy to.

Thank you for your good will.  
Following a hint from Igor, I have solved the problem.

I am publishing the procedure under the name “Howto setup mailman +  
nginx + thttpd cgi server + ubuntu 10.10 (debian)”, elsewhere in this  
mailing list.

M.
