1. 程式人生 > 其它 >Nginx 配置代理郵件服務囂

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 [email protected]
# 郵箱協議
set smtp="smtp.xxx.com"
# 郵箱賬號
set smtp-auth-user="[email protected]"
# 郵箱授權碼,QQ郵箱後臺裡面去授權
set smtp-auth-password="ABC123"
# 登陸方式
set smtp-auth=login
#################################

測試:
echo "goodluck" | mail -s "tittle" [email protected]