nginx做mail proxy 的时候,把消息proxy到哪里去了 4000
2015-11-28 23:10
651 查看
最近研究nginx代码, 以mail模块入手, 但是从配置看, 一直看不出来nginx把消息proxy到哪里去了.
今天研究了半天, 才搞这个事情搞清楚. 之前在网上也没有找到类似的说明, 包括官方的文档也没有说明.
mail模块有一个
以上的
nginx从这个响应中的
nginx会连接到这个ip:port,并与此按相就的邮件协议(如POP3)交互.
同时
If the “Auth-User” header exists in the response, it overrides the username used to authenticate with the backend.
今天研究了半天, 才搞这个事情搞清楚. 之前在网上也没有找到类似的说明, 包括官方的文档也没有说明.
mail模块有一个
ngx_mail_auth_http_module.c模块, 其中有一个配置命令
auth_http,nginx通过向此配置发送一个http请求,以获取得后端mail server的ip和端口. 比如:
Request: GET /auth HTTP/1.0 Host: localhost Auth-Method: plain # plain/apop/cram-md5 Auth-User: user Auth-Pass: password Auth-Protocol: imap # imap/pop3/smtp Auth-Login-Attempt: 1 Client-IP: 192.0.2.42 Client-Host: client.example.org Good response: HTTP/1.0 200 OK Auth-Status: OK Auth-Server: 198.51.100.1 Auth-Port: 143
以上的
Request是nginx发送给
auth_http配置的url的请求,
Good response是相应响应.
nginx从这个响应中的
Auth-Server和
Auth-Port获取得到后端mail server的ip和端口.
nginx会连接到这个ip:port,并与此按相就的邮件协议(如POP3)交互.
同时
If the “Auth-User” header exists in the response, it overrides the username used to authenticate with the backend.
相关文章推荐
- nginx代理指定目录
- 访问Nginx发生SSL connection error的一种情况
- Nginx+Naxsi部署专业级Web应用防火墙
- CentOS 6.2实战部署Nginx+MySQL+PHP
- nginx中http核心模块的配置指令2
- nginx中http核心模块的配置指令3
- nginx中http核心模块的配置指令4
- nginx中http的fastcgi模块的配置指令1
- Nginx 学习笔记(一)
- 网站502与504错误分析
- 艰难完成 nginx + puma 部署 rails 4的详细记录
- 把Lua编译进nginx步骤方法
- web 应用中常用的各种 cache详解
- Linux系统上配置Nginx+Ruby on Rails+MySQL超攻略
- window+nginx+php环境配置 附配置搭配说明
- 检测邮箱地址是否合法 Check Mail Address (For: IE5+、FF1.06、Opera 7+ ...)[
- PHP mail 通过Windows的SMTP发送邮件失败的解决方案
- 解析CI即CodeIgniter框架在Nginx下的重写规则
- 将PHP从5.3.28升级到5.3.29时Nginx出现502错误