Sending mail with nginx


#1

I’ve been using nginx to proxy to rails apps, and this has been quite
successful (thanks). But now I need to host a client’s site which has a
very
simple mail contact form (previously written in coldfusion running on
IIS).
Now that I have to port this contact form to linux, the natural thought
was
to use CGI. FastCGI is really overkill, I don’t need a persistent
process
just waiting for someone to send mail through a webform. A FAQ entry on
“How
to use nginx as SMTP proxy with a postfix backend?” looked promising,
though
documentation was empty and I imagine that nginx probably couldn’t pass
parameters in a neat format if at all (though I’d love to be proven
wrong-
how does fastmail.fm send mail?). The other option I’ve seen is to proxy
to
something else like thttpd and have thttpd execute a CGI script, though
this
doesn’t seem to be any better than FastCGI, and I’d really prefer the
light
footprint of CGI, which only runs when asked (which, for this particular
client, will not be very often). As I don’t have a separate mail server,
I
don’t need authentication, postfix will only send mail when the request
is
on the same host.

Can anybody clue me in to some best practices in this case?

Thanks very much-
Liam M.


#2

On Tue, Oct 28, 2008 at 3:51 PM, Maxim D. removed_email_address@domain.invalid
wrote:

Since nginx has no CGI support, you should either use backend
server that handles CGI, or set up some FastCGI wrapper for this.

What would you recommend for a backend server that does only CGI?


#3

Hello!

On Tue, Oct 28, 2008 at 04:27:12PM -0400, Liam M. wrote:

I’ve been using nginx to proxy to rails apps, and this has been quite
successful (thanks). But now I need to host a client’s site which has a very
simple mail contact form (previously written in coldfusion running on IIS).
Now that I have to port this contact form to linux, the natural thought was
to use CGI. FastCGI is really overkill, I don’t need a persistent process
just waiting for someone to send mail through a webform.

Since nginx has no CGI support, you should either use backend
server that handles CGI, or set up some FastCGI wrapper for this.

A FAQ entry on “How
to use nginx as SMTP proxy with a postfix backend?” looked promising, though
documentation was empty and I imagine that nginx probably couldn’t pass
parameters in a neat format if at all (though I’d love to be proven wrong-
how does fastmail.fm send mail?).

This is completely different beast. With mail module, nginx can
be used to proxy smtp/pop3/imap - but this is needed only if you
run [huge] mail server, and has nothing to do with http and html
forms.

[…]

Maxim D.