nginx:[emerg] 1#1:" mail" /etc/nginx/conf.d/default.conf中不允许使用该指令

时间:2017-11-14 23:00:13

标签: nginx nginx-reverse-proxy

尝试在nginx上获取邮件反向代理的基本电子邮件。我正在使用官方的nginx docker镜像,我有以下nginx配置设置。

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

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

    imap_capabilities IMAP4rev1 UIDPLUS IDLE LITERAL+ QUOTA;

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

    smtp_auth         login plain cram-md5;
    smtp_capabilities "SIZE 10485760" ENHANCEDSTATUSCODES 8BITMIME DSN;
    xclient           off;

    server {
        listen   25;
        protocol smtp;
    }
    server {
        listen   110;
        protocol pop3;
        proxy_pass_error_message on;
    }
    server {
        listen   143;
        protocol imap;
    }
    server {
        listen   587;
        protocol smtp;
    }
}

用以下命令盯着nginx后

nginx -g 'daemon off;'

我收到此错误:

2017/11/14 22:54:00 [emerg] 1#1: "mail" directive is not allowed here in /etc/nginx/conf.d/default.conf:9

有任何建议如何解决此问题?

1 个答案:

答案 0 :(得分:0)

将以下行添加到nginx conf的第一行中可以帮助我摆脱该错误

load_module /usr/ports/www/nginx-full/work/stage/usr/local/libexec/nginx/ngx_mail_module.so;

您可能想要更改适合的路径