Jinnrry / PMail

Private EMail Server
GNU General Public License v2.0
1.38k stars 120 forks source link

请问如何设置PMail和nginx reverse proxy? #151

Closed Yeeler closed 1 month ago

Jinnrry commented 1 month ago

请描述你遇到的问题

Yeeler commented 1 month ago

多谢 大佬的这个项目。 以下是我的配置文件,已经成功安装。 我用nginx反向代理80端口,证书也是安装在nginx上。做了发件测试。认证有问题,我需要如何手动生成证书 或者 可以拷贝 certbot为nginx创建的证书?

{ "logLevel": "info", //log output level "domain": "domain.com", // Your domain "webDomain": "mail.domain.com", // web domain "dkimPrivateKeyPath": "config/dkim/dkim.priv", // dkim key path "sslType": "1", // ssl certificate update mode, 0 automatic, 1 manual "SSLPrivateKeyPath": "config/ssl/private.key", // ssl certificate path "SSLPublicKeyPath": "config/ssl/public.crt", // ssl certificate path "dbDSN": "./config/pmail.db", // database connect DSN "dbType": "sqlite", //database type ,sqlite or mysql "httpsEnabled": 0, // enabled https , 0:enabled 1:enablde 2:disenabled "httpPort": 80, // http port . default 80 "httpsPort": 443, // https port . default 443 "spamFilterLevel": 0,// Spam filter level, 0: no filter, 1: filtering when spf and dkim don't pass, 2: filtering when spf don't pass "isInit": false // If false, it will enter the bootstrap process. }

screencapture-mail-tester-test-p9jm5wjse-reloaded-1-2024-07-10-13_20_37

Jinnrry commented 1 month ago

1、nginx管理证书的话把httpsEnabled设置成2 2、dkim错误,你dns没有设置dkim密钥吧

Yeeler commented 1 month ago

之前mx记录弄错了 现在出现了

pmail-1 | [error][2024-07-10 22:41:59][c0a84002668e9db362dc0001ce5092b0][/work/utils/send/send.go:206][0xc0003f5920] 邮件投递失败dial tcp 94.23.206.89:25: i/o timeout

替换了我的域名为aaa.com 其它日志没有修改。

yeeler@origin:~/PMail/server$ cat docker-compose.yml version: '3.8'

services: pmail: image: ghcr.io/jinnrry/pmail:latest ports:

yeeler@origin:~/PMail/server$ docker compose up WARN[0000] /home/yeeler/PMail/server/docker-compose.yml: version is obsolete [+] Running 1/0 ✔ Container server-pmail-1 Created 0.0s Attaching to pmail-1 pmail-1 | [info][2024-07-10 21:15:01][/work/main.go:81]***** pmail-1 | [info][2024-07-10 21:15:01][/work/main.go:82]* Server Start Success pmail-1 | pmail-1 | [info][2024-07-10 21:15:01][/work/main.go:83] Server Version: v2.5.3 pmail-1 | pmail-1 | [info][2024-07-10 21:15:01][/work/main.go:84] Git Commit Hash: 402e00150d97f2293b9065319ef8aedd3b09a900 pmail-1 | [info][2024-07-10 21:15:01][/work/main.go:85] Build Date: 2024-07-08 16:49:03 pmail-1 | [info][2024-07-10 21:15:01][/work/main.go:86] Build GoLang Version: go version go1.22.5 linux/amd64 pmail-1 | [info][2024-07-10 21:15:01][/work/main.go:87]*** pmail-1 | [info][2024-07-10 21:15:01][/work/http_server/setup_server.go:50]HttpServer Start On Port :80 pmail-1 | [info][2024-07-10 21:15:01][/work/http_server/setup_server.go:52]Please click http://58.7.217.50 to continue. pmail-1 | pmail-1 | [info][2024-07-10 21:21:10][/work/http_server/setup_server.go:71]Setup End! pmail-1 | [info][2024-07-10 21:21:10][/work/hooks/base.go:181][telegram_push] Plugin Load pmail-1 | [telegram_push] Plugin Start! PID:11[info][2024-07-10 21:21:11][/work/hooks/base.go:213][telegram_push] Plugin Load Success! pmail-1 | [info][2024-07-10 21:21:11][/work/hooks/base.go:181][web_push] Plugin Load pmail-1 | [web_push] Plugin Start! PID:15[info][2024-07-10 21:21:12][/work/hooks/base.go:213][web_push] Plugin Load Success! pmail-1 | [info][2024-07-10 21:21:12][/work/hooks/base.go:181][wechat_push] Plugin Load pmail-1 | [wechat_push] Plugin Start! PID:20[info][2024-07-10 21:21:13][/work/hooks/base.go:213][wechat_push] Plugin Load Success! pmail-1 | [warning][2024-07-10 21:21:13][/work/res_init/init.go:52]Config File Info: {"logLevel":"debug","domain":"aaa.com","domains":["aaa.com"],"webDomain":"email.aaa.com","dkimPrivateKeyPath":"config/dkim/dkim.priv","sslType":"1","SSLPrivateKeyPath":"./config/ssl/private.key","SSLPublicKeyPath":"./config/ssl/public.crt","dbDSN":"./config/pmail_temp.db","dbType":"sqlite","httpsEnabled":2,"spamFilterLevel":0,"httpPort":80,"httpsPort":443,"weChatPushAppId":"","weChatPushSecret":"","weChatPushTemplateId":"","weChatPushUserId":"","tgBotToken":"","tgChatId":"","isInit":true,"webPushUrl":"","webPushToken":""} pmail-1 | [info][2024-07-10 21:21:13][/work/pop3_server/pop3server.go:27]POP3 With TLS Server Start On Port :995 pmail-1 | [info][2024-07-10 21:21:13][/work/http_server/http_server.go:80]HttpServer Start On Port :80 pmail-1 | [info][2024-07-10 21:21:13][/work/smtp_server/smtp.go:175]Starting Smtp Server Port: :25 pmail-1 | [info][2024-07-10 21:21:13][/work/pop3_server/pop3server.go:46]POP3 Server Start On Port :110 pmail-1 | [info][2024-07-10 21:21:13][/work/smtp_server/smtp.go:147]Starting Smtp With SSL Server Port: :465 pmail-1 | [info][2024-07-10 22:41:55][c0a84002668e9db362dc0001ce5092b0][/work/controllers/email/send.go:57]发送邮件 pmail-1 | [debug][2024-07-10 22:41:55][c0a84002668e9db362dc0001ce5092b0][/work/controllers/email/send.go:152]插件执行--SendBefore pmail-1 | [debug][2024-07-10 22:41:55][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:50][telegram_push]Plugin SendBefore Start pmail-1 | [debug][2024-07-10 22:41:55][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:69][telegram_push]Plugin SendBefore End pmail-1 | [debug][2024-07-10 22:41:55][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:50][web_push]Plugin SendBefore Start pmail-1 | [debug][2024-07-10 22:41:55][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:69][web_push]Plugin SendBefore End pmail-1 | [debug][2024-07-10 22:41:55][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:50][wechat_push]Plugin SendBefore Start pmail-1 | [debug][2024-07-10 22:41:55][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:69][wechat_push]Plugin SendBefore End pmail-1 | [debug][2024-07-10 22:41:55][c0a84002668e9db362dc0001ce5092b0][/work/controllers/email/send.go:159]插件执行--SendBefore End pmail-1 | [debug][2024-07-10 22:41:55][c0a84002668e9db362dc0001ce5092b0][/work/utils/send/send.go:126]Message Infos : DKIM-Signature: a=rsa-sha256; bh=AvGVhN+GtYF80NHMbZfQ0T8u36n9hvpO/261mAmWJug=; pmail-1 | c=simple/simple; d=aaa.com; pmail-1 | h=Content-Type:Mime-Version:Subject:To:From:Message-Id:Date; s=default; pmail-1 | t=1720622515; v=1; pmail-1 | b=px0Y9eZDpYzk9mVJI2iC1IqytuMZp/yci/9QoxdM/GgbtGGHx9mb/PmLfjpEiTss1dE20mKE pmail-1 | o6Fu+OVdqfQbZTyC1XqV02RfA/2xELQhzyT/IPN+G66dloXsE9UPI8FQwQ2WzPAqJ5FfcJZ9qLE pmail-1 | 4lVI7fFtBMNvrjXOMkowkRPU= pmail-1 | Content-Type: multipart/mixed; pmail-1 | boundary=a1d15c05e5828359ba6fc6e435cb69554fce6e279f5df5655f362e241a19 pmail-1 | Mime-Version: 1.0 pmail-1 | Subject: 8888 pmail-1 | To: test-wrmczp7m3@srv1.mail-tester.com pmail-1 | From: "admin" admin@aaa.com pmail-1 | Message-Id: 13@aaa.com pmail-1 | Date: Wed, 10 Jul 2024 22:41:55 +0800 pmail-1 | pmail-1 | --a1d15c05e5828359ba6fc6e435cb69554fce6e279f5df5655f362e241a19 pmail-1 | Content-Type: multipart/alternative; pmail-1 | boundary=52cb644be835e9abd3d01a32e34333e9071184ea2af8d215f54501fcf664 pmail-1 | pmail-1 | --52cb644be835e9abd3d01a32e34333e9071184ea2af8d215f54501fcf664 pmail-1 | Content-Transfer-Encoding: quoted-printable pmail-1 | Content-Disposition: inline pmail-1 | Content-Type: text/plain; charset=UTF-8 pmail-1 | pmail-1 | hello pmail-1 | --52cb644be835e9abd3d01a32e34333e9071184ea2af8d215f54501fcf664 pmail-1 | Content-Transfer-Encoding: quoted-printable pmail-1 | Content-Disposition: inline pmail-1 | Content-Type: text/html; charset=UTF-8 pmail-1 | pmail-1 |

hello

pmail-1 | --52cb644be835e9abd3d01a32e34333e9071184ea2af8d215f54501fcf664-- pmail-1 | pmail-1 | --a1d15c05e5828359ba6fc6e435cb69554fce6e279f5df5655f362e241a19-- pmail-1 | pmail-1 | [error][2024-07-10 22:41:59][c0a84002668e9db362dc0001ce5092b0][/work/utils/send/send.go:206][0xc0003f5920] 邮件投递失败dial tcp 94.23.206.89:25: i/o timeout pmail-1 | [debug][2024-07-10 22:41:59][c0a84002668e9db362dc0001ce5092b0][/work/controllers/email/send.go:196]插件执行--SendAfter pmail-1 | [debug][2024-07-10 22:41:59][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:74][wechat_push]Plugin SendAfter Start pmail-1 | [error][2024-07-10 22:41:59][/work/hooks/framework/framework.go:112]params error json: cannot unmarshal object into Go struct field HookDTO.ErrMap of type error pmail-1 | [debug][2024-07-10 22:41:59][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:74][telegram_push]Plugin SendAfter Start pmail-1 | [debug][2024-07-10 22:41:59][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:88][wechat_push]Plugin SendAfter End pmail-1 | [debug][2024-07-10 22:41:59][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:74][web_push]Plugin SendAfter Start pmail-1 | [error][2024-07-10 22:41:59][/work/hooks/framework/framework.go:112]params error json: cannot unmarshal object into Go struct field HookDTO.ErrMap of type error pmail-1 | [error][2024-07-10 22:41:59][/work/hooks/framework/framework.go:112]params error json: cannot unmarshal object into Go struct field HookDTO.ErrMap of type error pmail-1 | [debug][2024-07-10 22:41:59][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:88][telegram_push]Plugin SendAfter End pmail-1 | [debug][2024-07-10 22:41:59][c0a84002668e9db362dc0001ce5092b0][/work/hooks/base.go:88][web_push]Plugin SendAfter End pmail-1 | [debug][2024-07-10 22:41:59][c0a84002668e9db362dc0001ce5092b0][/work/controllers/email/send.go:208]插件执行--SendAfter

Jinnrry commented 1 month ago

邮件投递失败dial tcp 94.23.206.89:25: i/o timeout

你服务器被封25端口了吧?阿里云、腾讯云之类的服务器,需要提工单给客户,申请解封25端口

Yeeler commented 1 month ago

我用的是家里的宽带 做了端口mapping. IP一直是变的 用了 dynu 作了动态域名解析。 不知道他们能不能开放 不行就换宽带服务商了。