Mail proxy config

Hello,

I am having hard times trying to get nginx proxy pop,imap and smtp to
localhost and remote mail hosts.
it works fine for the http part but not for mail proxying.

nginx seems to be listening to the standard ports but doesn’t forward to
the back end server as expected.

The debian package doesn’t include the mail modules , so I compiled from
th 0.6.29 source.

I think I am missing something in the configuration at the
authentication stage.

Do I need to configure the module auth somewhere ? it doesn’t exist in
the source or in the cgi-bin directory.

I also tried to use the php script that is given as an example but I am
getting errors on the script

PHP Parse error: syntax error, unexpected ‘{’ in /var/www/auth.php on
line 28.

Removing the unexpected brackets introduce an error at the next line of
the script

PHP Parse error: syntax error, unexpected ‘;’ in /var/www/auth.php on
line 37

if anyone can share his experience with the setup of a reverse pop/imap
proxy I would be delighted.

thanks for your help

M.Dahoumane

my nginx.conf file is below:

user www-data;
worker_processes 2;

error_log /var/log/nginx/error.log;
pid /var/run/nginx/nginx.pid;

events {
worker_connections 512;
}

mail {

auth_http 

http://wiki.codemongers.com/NginxMailAuthModule#auth_http
localhost:8000/cgi-bin/auth
http://wiki.codemongers.com/NginxMailCoreModule#auth;

pop3_capabilities 

http://wiki.codemongers.com/NginxMailCoreModule#pop3_capabilities
“TOP” “USER”;
imap_capabilities
http://wiki.codemongers.com/NginxMailCoreModule#imap_capabilities
“IMAP4rev1” “UIDPLUS”;

server <http://wiki.codemongers.com/NginxHttpCoreModule#server> {
    listen <http://wiki.codemongers.com/NginxHttpCoreModule#listen> 

110;
protocol
http://wiki.codemongers.com/NginxMailCoreModule#protocol pop3;
proxy http://wiki.codemongers.com/NginxMailProxyModule#proxy
on;
}

server <http://wiki.codemongers.com/NginxHttpCoreModule#server> {
    listen <http://wiki.codemongers.com/NginxHttpCoreModule#listen> 

143;
protocol
http://wiki.codemongers.com/NginxMailCoreModule#protocol imap;
proxy http://wiki.codemongers.com/NginxMailProxyModule#proxy
on;
}
}

http {
include /etc/nginx/mime.types;
#default_type application/octet-stream;
default_type text/plain;

access_log    /var/log/nginx/access.log;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;
tcp_nodelay        on;

gzip  on;

include /etc/nginx/sites-enabled/*;

}

/etc/conf default :

server {
listen 8000;
server_name localhost;

access_log  /var/log/nginx/localhost.access.log;

location / {
    root   /var/www/;
    index  index.html index.htm;
}

#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/;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
location ~ \.php$ {
    proxy_pass   http://127.0.0.1;
}

}

deny access to .htaccess files, if Apache's document root
concurs with nginx's one
  location ~ /\.ht {
    deny  all;
}

}

Hello!

On Thu, May 01, 2008 at 10:05:00PM +0200, [email protected]
wrote:

[…]

I think I am missing something in the configuration at the authentication
stage.

Do I need to configure the module auth somewhere ? it doesn’t exist in the
source or in the cgi-bin directory.

You have to write authentication script. The first thing nginx
does is passing authentication requests to auth_http endpoint. If
nothing correctly answers at specified url - it won’t be able to
do anything.

I also tried to use the php script that is given as an example but I am
getting errors on the script

You should either fix errors or write your own script.

[…]

auth_http http://wiki.codemongers.com/NginxMailAuthModule#auth_http localhost:8000/cgi-bin/auth http://wiki.codemongers.com/NginxMailCoreModule#auth;

pop3_capabilities http://wiki.codemongers.com/NginxMailCoreModule#pop3_capabilities “TOP” “USER”;
imap_capabilities http://wiki.codemongers.com/NginxMailCoreModule#imap_capabilities “IMAP4rev1” “UIDPLUS”;

Do you really have all this http://... in your config? You
shouldn’t.

Maxim D.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs