[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

nginx mail proxy



Hello

I want to configure email proxy server with Nginx. Actually I already
do this with Postfix. But my goal is to make it Nginx. To learn... I
have configured Nginx with email module. You can see it below.

# nginx -V
nginx version: nginx/1.20.2
built by gcc 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
built with OpenSSL 1.1.1f  31 Mar 2020
TLS SNI support enabled
configure arguments: --user=www-data --group=www-data
--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--with-http_gzip_static_module --with-http_stub_status_module
--with-http_ssl_module --with-file-aio --with-http_geoip_module
--with-http_realip_module --without-http_scgi_module
--without-http_uwsgi_module --without-http_rewrite_module --with-mail

the error is as follows:

# nginx -t
nginx: [emerg] "mail" directive is not allowed here in /etc/nginx/conf.d/1:3
nginx: configuration file /etc/nginx/nginx.conf test fail


Config:

mail {
    server_name 98281.domain.com;
    auth_http   localhost:9000/cgi-bin/nginxauth.cgi;

    proxy_pass_error_message on;

    ssl                 on;
    ssl_certificate     /etc/ssl/certs/server.crt;
    ssl_certificate_key /etc/ssl/certs/server.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;
    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 10m;

    server {
        listen     25;
        protocol   smtp;
        smtp_auth  login plain cram-md5;
    }

    server {
        listen    110;
        protocol  pop3;
        pop3_auth plain apop cram-md5;
}

     server {
        listen   143;
        protocol imap;
    }
}


What could be the problem?

-- 
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀


Reply to: