Nginx 配置代理邮件服务嚣

Nginx 配置代理邮件服务嚣

一. 安装 Nginx 1.20.2

1.  安装:

./configure \
--prefix=/data/webapp/nginx \
--with-openssl=/root/soft/lnmp/temp/openssl-1.1.1m \
--with-stream \
--with-stream_ssl_module \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--error-log-path=/data/logs/nginx/error.log \
--add-module=../ngx_cache_purge-2.3

make
make   install

2. 配置文件 nginx.conf

# 邮件服务器代理 需要使用--with-stream模块
stream {
    server {
    listen 25;
    proxy_pass mail.xxxxxx.cn:25; # 企业邮件服务器
    }
}

3. 重启 Nginx

 

附:centos7 配企业邮箱发信:
yum  install  mailx
vi   /etc/mail.rc
#################################

# 指定邮箱
set from=monitor@xxx.com
# 邮箱协议
set smtp="smtp.xxx.com"
# 邮箱账号
set smtp-auth-user="monitor@xxx.com"
# 邮箱授权码,QQ邮箱后台里面去授权
set smtp-auth-password="ABC123"
# 登陆方式
set smtp-auth=login
#################################

测试:
echo "goodluck" | mail -s "tittle" xxx@xxx.com

 

posted @ 2022-05-23 16:00  莫让年华付水流  阅读(1836)  评论(0编辑  收藏  举报