Jinnrry/PMail

所有浏览器都出现 ”此页面不能正确地重定向“

Closed this issue · 11 comments

版本:v2.2.6

使用不同的浏览器打开都出现了如下页面
图片

使用docker搭建,docker日志输出没有报错,日志如下
pmail | [info][2023-10-07 15:19:46][/work/main.go:76]***************************************************
pmail | [info][2023-10-07 15:19:46][/work/main.go:77]*** Server Start Success Version:2.2.6
pmail |
pmail |
pmail | [info][2023-10-07 15:19:46][/work/main.go:78]*** Git Commit Hash:
pmail | [info][2023-10-07 15:19:46][/work/main.go:79]*** Build TimeStamp: 2023-09-28 10:24:29
pmail | [info][2023-10-07 15:19:46][/work/main.go:80]*** Build GoLang Version: go version go1.21.1 linux/amd64
pmail | [info][2023-10-07 15:19:46][/work/main.go:81]***************************************************
pmail | [info][2023-10-07 15:19:46][/work/res_init/init.go:22]Please click http://127.0.0.1 to continue.
pmail |
pmail |
pmail | [info][2023-10-07 15:40:31][/work/db/init.go:73]Create Table: CREATE table email
pmail | (
pmail | id INTEGER PRIMARY KEY AUTOINCREMENT,
pmail | type tinyint(4) NOT NULL DEFAULT 0,
pmail | group_id INTEGER NOT NULL DEFAULT 0,
pmail | subject varchar(1000) NOT NULL DEFAULT '',
pmail | reply_to json,
pmail | from_name varchar(50) NOT NULL DEFAULT '',
pmail | from_address varchar(150) NOT NULL DEFAULT '',
pmail | to json,
pmail | bcc json,
pmail | cc json,
pmail | text text,
pmail | html text,
pmail | sender json,
pmail | attachments json ,
pmail | spf_check tinyint(1) DEFAULT 0 ,
pmail | dkim_check tinyint(1) DEFAULT 0 ,
pmail | status tinyint(4) NOT NULL DEFAULT 0 ,
pmail | send_user_id int unsigned NOT NULL DEFAULT 0 ,
pmail | is_read tinyint(1) NOT NULL DEFAULT 0 ,
pmail | error text ,
pmail | cron_send_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
pmail | send_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
pmail | create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ,
pmail | update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
pmail | )
pmail | [info][2023-10-07 15:40:31][/work/db/init.go:73]Create Table: CREATE TABLE group
pmail | (
pmail | id INTEGER PRIMARY KEY AUTOINCREMENT,
pmail | name varchar(10) NOT NULL DEFAULT '',
pmail | parent_id INTEGER NOT NULL DEFAULT 0,
pmail | user_id INTEGER NOT NULL DEFAULT 0
pmail | )
pmail | [info][2023-10-07 15:40:31][/work/db/init.go:73]Create Table: create table rule
pmail | (
pmail | id INTEGER PRIMARY KEY AUTOINCREMENT,
pmail | user_id int,
pmail | name varchar(255) default '' not null,
pmail | value json not null,
pmail | action int default 0 not null,
pmail | params varchar(255) default '' not null,
pmail | sort int default 0 not null
pmail | )
pmail | [info][2023-10-07 15:40:31][/work/db/init.go:73]Create Table: CREATE TABLE sessions
pmail | (
pmail | token TEXT PRIMARY KEY,
pmail | data BLOB NOT NULL,
pmail | expiry REAL NOT NULL
pmail | );
pmail |
pmail |
pmail | CREATE INDEX sessions_expiry_idx ON sessions (expiry);
pmail | [info][2023-10-07 15:40:31][/work/db/init.go:73]Create Table: CREATE TABLE user
pmail | (
pmail | id INTEGER PRIMARY KEY AUTOINCREMENT,
pmail | account varchar(20),
pmail | name varchar(10),
pmail | password char(32)
pmail | );
pmail | CREATE UNIQUE INDEX udx_account on user (account);
pmail | [info][2023-10-07 15:40:31][/work/db/init.go:80]Init Table:
pmail | [info][2023-10-07 15:40:31][/work/db/init.go:73]Create Table: CREATE TABLE user_auth
pmail | (
pmail | id INTEGER PRIMARY KEY AUTOINCREMENT,
pmail | user_id int ,
pmail | email_account varchar(30)
pmail | );
pmail |
pmail |
pmail | CREATE UNIQUE INDEX udx_uid_ename on user_auth ( user_id, email_account);
pmail | CREATE UNIQUE INDEX udx_ename_uid on user_auth ( email_account,user_id );
pmail | [info][2023-10-07 15:40:31][/work/db/init.go:80]Init Table:
pmail | [info][2023-10-07 16:04:01][/work/smtp_server/smtp.go:70]Starting server at :25
pmail | [info][2023-10-07 16:04:01][/work/http_server/https_server.go:37]Http Server Start
pmail | [info][2023-10-07 16:14:44][/work/main.go:76]***************************************************
pmail | [info][2023-10-07 16:14:44][/work/main.go:77]*** Server Start Success Version:2.2.6
pmail |
pmail |
pmail | [info][2023-10-07 16:14:44][/work/main.go:78]*** Git Commit Hash:
pmail | [info][2023-10-07 16:14:44][/work/main.go:79]*** Build TimeStamp: 2023-09-28 10:24:29
pmail | [info][2023-10-07 16:14:44][/work/main.go:80]*** Build GoLang Version: go version go1.21.1 linux/amd64
pmail | [info][2023-10-07 16:14:44][/work/main.go:81]***************************************************
pmail | [info][2023-10-07 16:14:44][/work/smtp_server/smtp.go:70]Starting server at :25
pmail | [info][2023-10-07 16:14:44][/work/http_server/https_server.go:37]Http Server Start

你的配置文件发出来看看呢

docker-compose.yml

version: '3.9'
services:
pmail:
container_name: pmail
image: 'ghcr.io/jinnrry/pmail:latest'
volumes:
- './config:/work/config'
ports:
- '465:465'
- '8781:443'
- '8780:80'
- '25:25'

config.json

{"logLevel":"","domain":"seektao.cc","webDomain":"pmail.seektao.cc","dkimPrivateKeyPath":"config/dkim/dkim.priv","sslType":"1","SSLPrivateKeyPath":"config/ssl/private.key","SSLPublicKeyPath":"config/ssl/public.crt","dbDSN":"./config/pmail.db","dbType":"sqlite","httpsEnabled":0,"spamFilterLevel":0,"httpPort":0,"httpsPort":0,"weChatPushAppId":"","weChatPushSecret":"","weChatPushTemplateId":"","weChatPushUserId":"","tgBotToken":"","tgChatId":"","isInit":true}%

你docker把443端口映射到了8781,你pmail.seektao.cc这个域名的443端口转发到8781了吗?你可以exec进容器,然后curl 127.0.0.1试试,如果容器里面直接访问能通就是你转发配置有问题

容器镜像为了精简,用的alpine底包,不是debian系。

apk update
apk add curl

这样安装curl

图片

截图准确些

curl -k https://127.0.0.1:443

看下这个结果

ssl使用的是nginx proxy manager

{
"logLevel": "info", //日志输出级别
"domain": "domain.com", // 你的域名
"webDomain": "mail.domain.com", // web域名
"dkimPrivateKeyPath": "config/dkim/dkim.priv", // dkim 私钥地址
"sslType": "0", // ssl证书更新模式,0自动,1手动
"SSLPrivateKeyPath": "config/ssl/private.key", // ssl 证书地址
"SSLPublicKeyPath": "config/ssl/public.crt", // ssl 证书地址
"dbDSN": "./config/pmail.db", // 数据库连接DSN
"dbType": "sqlite", //数据库类型,支持sqlite 和 mysql
"httpsEnabled": 0, // web后台是否启用https 0默认(启用),1启用,2不启用
"spamFilterLevel": 0,// 垃圾邮件过滤级别,0不过滤、1 spf dkim 校验均失败时过滤,2 spf校验不通过时过滤
"httpPort": 80, // http 端口 . 默认 80
"httpsPort": 443, // https 端口 . 默认 443
"weChatPushAppId": "", // 微信推送appid
"weChatPushSecret": "", // 微信推送秘钥
"weChatPushTemplateId": "", // 微信推送模板id
"weChatPushUserId": "", // 微信推送用户id
"tgChatId": "", // telegram 推送chatid
"tgBotToken": "", // telegram 推送 token
"isInit": true // 为false的时候会进入安装引导流程
}

你用nginx管理ssl证书的话把httpsEnabled配置改成2

可以了可以了,感谢大佬~~,80,443被npm占用了,换端口感觉还是比较麻烦的。我到时候写个完整教程。

图片

图片

这中间因为不能用80端口,所以我还是用npm申请的ssl证书,ssl证书生成用的是dns,用的dnspod,还得把dnspod开启一个id,key。完了之后在生成,npm还缺少模块zope,又得进npm容器安装zope。最后生成的证书是pem结尾的,还得进行转换,这过程太心酸了。