我需要使用 nginx 作为邮件代理。我对 nginx 完全陌生,需要一些配置帮助。
这是我所做的:
首先,我构建了一个模拟此处描述的身份验证服务的服务:http ://wiki.nginx.org/NginxMailCoreModule 。例如,
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" http://localhost:8080/authorize
返回以下响应标头:
< HTTP/1.1 200 OK
< Content-Type: text/html;charset=ISO-8859-1
< Auth-Status: OK
< Auth-Server: 192.168.1.10
< Auth-Port: 110
其次,我在安装 macports 后在我的 mac 上安装了 nginx:
$ sudo port -d selfupdate
$ sudo port install nginx
第三,我使用以下内容创建了一个 nginx.conf:
worker_processes 1;
error_log /var/log/nginx/error.log info;
mail {
server_name <my mail server here>;
auth_http http://localhost:8080/authorize;
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;
}
}
这是我运行 nginx 的内容:
$ nginx -V nginx 版本:nginx/1.2.4 配置参数:--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
$ nginx nginx: [emerg] /opt/local/etc/nginx/nginx.conf:6 中的未知指令“mail”
网络上唯一提到该错误的地方引发了俄语讨论...
我的问题:
为什么我会收到这个未知指令?
我的配置乍一看是否正确,或者我是否缺少一些关键组件,以便邮件代理使用此处描述的身份验证方法工作:http ://wiki.nginx.org/NginxMailCoreModule ?