<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div class="post-text" itemprop="description"><p>I need to use nginx as a mail proxy.  I am completely new to nginx and need some help with the configuration.</p><p><strong>Here is what I did:</strong></p><p><strong>First</strong> I built a service that mocks the authentication services described here: <a href="http://wiki.nginx.org/NginxMailCoreModule" rel="nofollow">http://wiki.nginx.org/NginxMailCoreModule</a>.  For example,  </p>

<pre><code>curl -v -H "Host:auth.server.hostname" -H "Auth-Method:plain" -H "Auth-User:user" -H "Auth-pass:123" -H "Auth-Protocol:imap" -H "Auth-Login-Attempt:1" -H "Client-IP: 192.168.1.1" <a href="http://localhost:8080/authorize">http://localhost:8080/authorize</a>
</code></pre><p>returns the following response header (no matter what Auth-User, Auth-Protocol, and Client-IP are for now):</p><pre>< HTTP/1.1 200 OK
< Content-Type: text/html;charset=ISO-8859-1
< Auth-Status: OK
< Auth-Server: <my mail server here>
< Auth-Port: 110</pre><p><strong>Second</strong> I installed nginx on my mac after installing macports:</p>

<pre><code>$ sudo port -d selfupdate
$ sudo port install nginx
</code></pre><p><strong>Third</strong> I created an nginx.conf with the following:</p>

<pre>  worker_processes  1;

  error_log  /var/log/nginx/error.log info;

  mail {
    # not needed because returned in Auth-Server actually?
    server_name  <my mail server here>;
       
    auth_http    <a href="http://localhost:8080/authorize">http://localhost:8080/authorize</a>;

    pop3_auth         plain apop cram-md5;
    pop3_capabilities "LAST" "TOP" "USER" "PIPELINING" "UIDL";

    xclient off;

    server {
          listen     110;
          protocol   pop3;
          proxy      on;
          proxy_pass_error_message  on;
    }
  }</pre><p><strong>Here is what I got running nginx:</strong></p><p>$ nginx -V
nginx version: nginx/1.2.4
configure arguments: --prefix=/opt/local 
--with-cc-opt='-I/opt/local/include -O2' --with-ld-opt=-L/opt/local/lib 
--conf-path=/opt/local/etc/nginx/nginx.conf 
--error-log-path=/opt/local/var/log/nginx/error.log 
--http-log-path=/opt/local/var/log/nginx/access.log 
--pid-path=/opt/local/var/run/nginx/nginx.pid 
--lock-path=/opt/local/var/run/nginx/nginx.lock 
--http-client-body-temp-path=/opt/local/var/run/nginx/client_body_temp 
--http-proxy-temp-path=/opt/local/var/run/nginx/proxy_temp 
--http-fastcgi-temp-path=/opt/local/var/run/nginx/fastcgi_temp 
--http-uwsgi-temp-path=/opt/local/var/run/nginx/uwsgi_temp --with-ipv6</p><p>$ nginx 
nginx: [emerg] unknown directive "mail" in /opt/local/etc/nginx/nginx.conf:6</p><p>The only mention of that error on the web brings up a discussion in Russian and the translation is "This question is no longer relevant"</p><p>My questions:</p>

<ol>
<li><p>Why am I getting this unknow directive?</p></li>
<li><p>Does my config look correct at first sight or am I missing some 
key component for the mail proxy to work using the authentication 
approach described here: <a href="http://wiki.nginx.org/NginxMailCoreModule" rel="nofollow">http://wiki.nginx.org/NginxMailCoreModule</a>?</p><div><br></div><div>Thanks a lot. мерси!</div></li>
</ol></div></body></html>