# How to configure Nginx as IMAP/POP3 reverse proxy - IBM Lotus Domino Server

**URL:** <https://www.ruby-forum.com/t/how-to-configure-nginx-as-imap-pop3-reverse-proxy-ibm-lotus-domino-server/195599>\
**Category:** NGINX\
**Created:** [September 26, 2010, 11:25am UTC](https://www.ruby-forum.com/t/how-to-configure-nginx-as-imap-pop3-reverse-proxy-ibm-lotus-domino-server/195599 "2010-09-26T11:25:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juliana\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4da419/32.png) [@Juliana\_T](https://www.ruby-forum.com/u/Juliana_T)\
**Post date:** [September 26, 2010, 11:25am UTC](https://www.ruby-forum.com/t/how-to-configure-nginx-as-imap-pop3-reverse-proxy-ibm-lotus-domino-server/195599/1 "2010-09-26T11:25:34Z")

</div>

Hi all,  
I’m newbie with nginx.  
I have IBM Lotus Domino Server as an email server with IP Address  
192.168.221.1  
and Linux installed Nginx as IMAP/POP3 reverse proxy with IP Address  
192.168.221.130  
I’ve configured nginx.conf like below :  
#user nobody;  
worker\_processes 1;  
error\_log /usr/local/nginx/logs/error.log;  
pid /usr/local/nginx/logs/nginx.pid;  
events {  
worker\_connections 1024;  
multi\_accept on;  
}  
mail {  
auth\_http 192.168.221.1:81; #Domino server with http proxy (81)  
auth\_http\_timeout 6000;  
pop3\_auth “plain”;  
pop3\_capabilities “TOP” “USER”;  
imap\_capabilities “IMAP4rev1” “UIDPLUS”;  
server {  
listen 110;  
protocol pop3;  
proxy on;  
}  
server {  
listen 143;  
protocol imap;  
proxy on;  
}  
}  
When I tried telnet from client pc to Nginx, I get this response :  
C:\> telnet 192.168.221.130 110  
+OK POP3 ready  
C:\> telnet 192.168.221.130 143  
+OK IMAP4 ready  
I also can telnet from NGINX server to Domino and get this response :  
[root@centostest ~]# telnet 192.168.221.1 81  
Trying 192.168.221.1…  
Connected to 192.168.221.1 (192.168.221.1).  
Escape character is ‘^]’.  
[root@centostest ~]# telnet 192.168.221.1 110  
Trying 192.168.221.1…  
Connected to 192.168.221.1 (192.168.221.1).  
Escape character is ‘^]’.  
+OK Lotus Notes POP3 server version Release 8.5.1 ready on JULMAIL/JTHE.  
[root@centostest ~]# telnet 192.168.221.1 143  
Trying 192.168.221.1…  
Connected to 192.168.221.1 (192.168.221.1).  
Escape character is ‘^]’.

- OK Domino IMAP4 Server Release 8.5.1 ready Sun, 26 Sep 2010 13:56:39  
+1000  
ã€€  
Does anyone can help how to configure nginx to get response like below :  
When I telnet from client to 192.168.221.130 110  
C:\> telnet 192.168.221.130 110  
+OK Lotus Notes POP3 server version Release 8.5.1 ready on JULMAIL/JTHE.  
When I telnet from client to 192.168.221.130 143  
C:\> telnet 192.168.221.130 143
- OK Domino IMAP4 Server Release 8.5.1 ready Sun, 26 Sep 2010 13:56:39  
+1000  
ã€€  
Thanks

---

<div class="post-metadata">

**Author:** ![Juliana\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4da419/32.png) [@Juliana\_T](https://www.ruby-forum.com/u/Juliana_T)\
**Post date:** [September 26, 2010, 5:50pm UTC](https://www.ruby-forum.com/t/how-to-configure-nginx-as-imap-pop3-reverse-proxy-ibm-lotus-domino-server/195599/2 "2010-09-26T17:50:41Z")

</div>

Hello!

On Sun, Sep 26, 2010 at 02:24:21AM -0700, Juliana T. wrote:

> events {  
> worker\_connections 1024;  
> multi\_accept on;  
> }  
> mail {  
> auth\_http 192.168.221.1:81; #Domino server with http proxy (81)

This is obviously wrong as there is no URI of auth script.

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

> listen 143;  
> [root@centostest ~]# telnet 192.168.221.1 81  
> Connected to 192.168.221.1 (192.168.221.1).  
> Escape character is ‘^]’.
> 
> - OK Domino IMAP4 Server Release 8.5.1 ready Sun, 26 Sep 2010 13:56:39 +1000  
> ã€€  
> Does anyone can help how to configure nginx to get response like below :  
> When I telnet from client to 192.168.221.130 110  
> C:\> telnet 192.168.221.130 110  
> +OK Lotus Notes POP3 server version Release 8.5.1 ready on JULMAIL/JTHE.  
> When I telnet from client to 192.168.221.130 143  
> C:\> telnet 192.168.221.130 143
> - OK Domino IMAP4 Server Release 8.5.1 ready Sun, 26 Sep 2010 13:56:39 +1000

No, you can’t change server greeting lines in nginx.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Juliana\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4da419/32.png) [@Juliana\_T](https://www.ruby-forum.com/u/Juliana_T)\
**Post date:** [September 29, 2010, 6:20am UTC](https://www.ruby-forum.com/t/how-to-configure-nginx-as-imap-pop3-reverse-proxy-ibm-lotus-domino-server/195599/3 "2010-09-29T06:20:48Z")

</div>

Hi..  
Â  
Now the POP3 already running.  
But still have problem with IMAP.  
Â  
nginx.conf  
Â  
user nobody;  
worker\_processes 1;  
#error\_log logs/error.log;  
#error\_log logs/error.log notice;  
#error\_log logs/error.log info;  
error\_log /usr/local/nginx/logs/error.log;  
#pid logs/nginx.pid;  
pid /usr/local/nginx/logs/nginx.pid;  
ã€€  
events {  
worker\_connections 1024;  
multi\_accept on;  
}  
mail {  
auth\_http 127.0.0.1:80/auth;  
auth\_http\_timeout 6000;  
smtp\_auth plain;  
pop3\_auth plain;  
imap\_auth plain;  
pop3\_capabilities “TOP” “USER”;  
imap\_capabilities “IMAP4rev1” “UIDPLUS”;  
ã€€  
server {  
listen 110;  
protocol pop3;  
proxy on;  
}  
server {  
listen 143;  
protocol imap;  
proxy on;  
}

server {  
listen 25;  
protocol smtp;  
proxy on;  
}  
}  
http {  
include mime.types;  
default\_type application/octet-stream;  
perl\_modules perl/lib;  
perl\_require mailauth.pm;  
#log\_format main '$remote\_addr - $remote\_user [$time\_local] “$request” ’

# '$status $body\_bytes\_sent “$http\_referer” ’

# ‘“$http\_user\_agent” “$http\_x\_forwarded\_for”’;

#access\_log logs/access.log main;  
sendfile on;  
#tcp\_nopush on;  
#keepalive\_timeout 0;  
keepalive\_timeout 65;  
#gzip on;  
server {  
listen 80;  
server\_name localhost;  
#location /auth {  
location /auth {  
perl mailauth::handler;  
}  
#charset koi8-r;  
#access\_log logs/host.access.log main;  
location / {  
root html;  
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 html;  
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

# 

#location ~ .php$ {

# proxy\_pass [http://127.0.0.1](http://127.0.0.1);

#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

# 

#location ~ .php$ {

# root html;

# fastcgi\_pass 127.0.0.1:9000;

# fastcgi\_index index.php;

# fastcgi\_param SCRIPT\_FILENAME /scripts$fastcgi\_script\_name;

# include fastcgi\_params;

#}

# deny access to .htaccess files, if Apache’s document root

# concurs with nginx’s one

# 

#location ~ /.ht {

# deny all;

#}  
}  
Â  
Â  
mailauth.pm  
Â  
package mailauth;  
use nginx;

our $auth\_ok;  
our $mail\_server\_ip={“192.168.221.1”};  
our $protocol\_ports={};  
$domino=“192.168.221.1”;  
$protocol\_ports-\>{‘pop3’}=110;  
$protocol\_ports-\>{‘imap’}=143;  
$protocol\_ports-\>{‘smtp’}=25;

sub handler {  
my $r=shift;  
$auth\_ok=1;  
if ($auth\_ok==1){  
$r-\>header\_out(“Auth-Status”, “OK”) ;  
$r-\>header\_out(“Auth-Server”, $domino);  
$r-\>header\_out(“Auth-Port”,  
$protocol\_ports-\>{$r-\>header\_in(“Auth-Protocol”)});  
$r-\>header\_out(“Auth Plain”,$r-\>header\_in(“Auth Plain”));  
} else {  
$r-\>header\_out(“Auth-Status”, “Invalid login or password”) ;  
}

$r-\>send\_http\_header(“text/html”);

return OK;  
}

1;

— On Sun, 9/26/10, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

From: Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: How to configure Nginx as IMAP/POP3 reverse proxy - IBM  
Lotus Domino Server  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Sunday, September 26, 2010, 11:49 AM

Hello!

On Sun, Sep 26, 2010 at 02:24:21AM -0700, Juliana T. wrote:

> events {  
> worker\_connections 1024;  
> multi\_accept on;  
> }  
> mail {  
> auth\_http 192.168.221.1:81; #Domino server with http proxy (81)

This is obviously wrong as there is no URI of auth script.

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

> listen 143;  
> [root@centostest ~]# telnet 192.168.221.1 81  
> Connected to 192.168.221.1 (192.168.221.1).  
> Escape character is ‘^]’.
> 
> - OK Domino IMAP4 Server Release 8.5.1 ready Sun, 26 Sep 2010 13:56:39 +1000  
> ã€€  
> Does anyone can help how to configure nginx to get response like below :  
> When I telnet from client to 192.168.221.130 110  
> C:\> telnet 192.168.221.130 110  
> +OK Lotus Notes POP3 server version Release 8.5.1 ready on JULMAIL/JTHE.  
> When I telnet from client to 192.168.221.130 143  
> C:\> telnet 192.168.221.130 143
> - OK Domino IMAP4 Server Release 8.5.1 ready Sun, 26 Sep 2010 13:56:39 +1000

No, you can’t change server greeting lines in nginx.

Maxim D.
