用几个配置文件搭建一个10分的域名邮箱

同步来源:树洞剪藏 源站剪藏 ID:56 原文地址:https://www.nodeseek.com/post-152075-1
用几个配置文件搭建一个10分的域名邮箱
NodeSeek beta 日常 技术 情报 测评 交易 拼车 推广
用几个配置文件搭建一个10分的域名邮箱
Guu 楼主 79days ago edited 79days ago in 技术 #0
说明
基于Mailu https://mailu.io/2.0/ ;
我几乎所有的服务,一个docker-compose.yml文件,一个nginx文件基本都可以搞定;
配置文件只有3个,看着长,实际上复制粘贴,稍作修改即可(所有example.com替换为自己的,还有一个证书位置、ip、key);
内存平均占用500多M,CPU平均1%左右,1C1G小鸡都行,
条件/准备
Docker
Nginx
域名以及证书
可 rDNS 以及开启25端口的vps
Docker
新建一个目录,比如mailu,里面创建 docker-compose.yml ,记得改ssl证书位置
version: '2.2'
services:
External dependencies
redis: image: redis:alpine restart: always container_name: mailu-redis volumes:
- "./redis:/data" depends_on:
- resolver dns:
- 172.30.1.254
Core services
front: image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}nginx:${MAILU_VERSION:-2.0} restart: always container_name: mailu-nginx env_file: mailu.env logging: driver: journald options: tag: mailu-front ports:
- "127.0.0.1:8880:80"
- "127.0.0.1:44443:443"
- "127.0.0.1:25:25"
- "127.0.0.1:465:465"
- "127.0.0.1:587:587"
- "127.0.0.1:110:110"
- "127.0.0.1:995:995"
- "127.0.0.1:143:143"
- "127.0.0.1:993:993" networks:
- default
- webmail volumes:
- "/etc/nginx/ssl/example.com:/certs:ro" #ssl证书位置
- "./overrides/nginx:/overrides:ro" depends_on:
- resolver dns:
- 172.30.1.254
resolver: image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}unbound:${MAILU_VERSION:-2.0} env_file: mailu.env container_name: mailu-unbound restart: always networks: default: ipv4_address: 172.30.1.254
admin: image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}admin:${MAILU_VERSION:-2.0} restart: always env_file: mailu.env container_name: mailu-admin logging: driver: journald options: tag: mailu-admin volumes:
- "./data:/data"
- "./dkim:/dkim" depends_on:
- redis
- resolver dns:
- 172.30.1.254
imap: image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}dovecot:${MAILU_VERSION:-2.0} restart: always env_file: mailu.env container_name: mailu-dovecot logging: driver: journald options: tag: mailu-imap volumes:
- "./mail:/mail"
- "./overrides/dovecot:/overrides:ro" depends_on:
- front
- resolver dns:
- 172.30.1.254
smtp: image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}postfix:${MAILU_VERSION:-2.0} restart: always env_file: mailu.env container_name: mailu-postfix logging: driver: journald options: tag: mailu-smtp volumes:
- "./mailqueue:/queue"
- "./overrides/postfix:/overrides:ro" depends_on:
- front
- resolver dns:
- 172.30.1.254
oletools: image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}oletools:${MAILU_VERSION:-2.0} hostname: oletools container_name: mailu-oletools restart: always networks:
- noinet depends_on:
- resolver dns:
- 172.30.1.254
antispam: image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}rspamd:${MAILU_VERSION:-2.0} hostname: antispam restart: always container_name: mailu-rspamd env_file: mailu.env logging: driver: journald options: tag: mailu-antispam networks:
- default
- noinet volumes:
- "./filter:/var/lib/rspamd"
- "./overrides/rspamd:/overrides:ro" depends_on:
- front
- redis
- oletools
- resolver dns:
- 172.30.1.254
Optional services
fetchmail: image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}fetchmail:${MAILU_VERSION:-2.0} restart: always env_file: mailu.env container_name: mailu-fetchmail volumes:
- "./data/fetchmail:/data" depends_on:
- admin
- smtp
- imap
- resolver dns:
- 172.30.1.254
Webmail
webmail: image: ${DOCKER_ORG:-ghcr.io/mailu}/${DOCKER_PREFIX:-}webmail:${MAILU_VERSION:-2.0} restart: always env_file: mailu.env container_name: mailu-webmail volumes:
- "./webmail:/data"
- "./overrides/roundcube:/overrides:ro" networks:
- webmail depends_on:
- front
networks: default: driver: bridge ipam: driver: default config:
- subnet: 172.30.1.0/24 webmail: driver: bridge noinet: driver: bridge internal: true
同目录创建环境配置文件 mailu.env ,要改域名、IP和SECRET_KEY
16位随机key
SECRET_KEY=aaaaaaaaaaaaaaaa
docker子网
SUBNET=172.30.1.0/24
一级域名
DOMAIN=example.com
二级域名
HOSTNAMES=mail.example.com
Postmaster local part (will append the main mail domain)
POSTMASTER=admin
Choose how secure connections will behave (value: letsencrypt, cert, notls, mail, mail-letsencrypt)
TLS_FLAVOR=mail TLS_KEYPAIR_FILENAME=privkey.pem TLS_CERT_FILENAME=fullchain.pem
Authentication rate limit per IP (per /24 on ipv4 and /48 on ipv6)
AUTH_RATELIMIT_IP=5/hour
Authentication rate limit per user (regardless of the source-IP)
AUTH_RATELIMIT_USER=50/day
Opt-out of statistics, replace with "True" to opt out
DISABLE_STATISTICS=True
Expose the admin interface (value: true, false)
ADMIN=true
Choose which webmail to run if any (values: roundcube, snappymail, none)
WEBMAIL=roundcube
Expose the API interface (value: true, false)
API=false
Dav server implementation (value: radicale, none)
WEBDAV=none
Antivirus solution (value: clamav, none)
ANTIVIRUS=none
Scan Macros solution (value: true, false)
SCAN_MACROS=true
Message size limit in bytes
Default: accept messages up to 50MB
Max attachment size will be 33% smaller
MESSAGE_SIZE_LIMIT=50000000
Message rate limit (per user)
MESSAGE_RATELIMIT=200/day
Enable fetchmail
FETCHMAIL_ENABLED=true
Fetchmail delay
FETCHMAIL_DELAY=600
Recipient delimiter, character used to delimiter localpart from custom address part
RECIPIENT_DELIMITER=+
DMARC rua and ruf email
DMARC_RUA=admin DMARC_RUF=admin
Welcome email, enable and set a topic and body if you wish to send welcome
emails to all users.
WELCOME=false WELCOME_SUBJECT=Welcome to your new email account WELCOME_BODY=Welcome to your new email account, if you can read this, then it is configured properly!
IMAP full-text search is enabled by default. Set the following variable to off in order to disable the feature.
FULL_TEXT_SEARCH=off
Path to redirect / to
WEBROOT_REDIRECT=/webmail
Path to the admin interface if enabled
WEB_ADMIN=/admin
Path to the webmail if enabled
WEB_WEBMAIL=/webmail
Path to the API interface if enabled
WEB_API=/api
Website name
SITENAME=Mailu
二级域名
WEBSITE=https://mail.example.com
Docker-compose project name, this will prepended to containers names.
COMPOSE_PROJECT_NAME=mailu
Number of rounds used by the password hashing scheme
CREDENTIAL_ROUNDS=12
Header to take the real ip from
REAL_IP_HEADER=X-Real-IP
服务器ip
REAL_IP_FROM=114.5.1.4
Log level threshold in start.py (value: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET)
LOG_LEVEL=WARNING
Timezone for the Mailu containers. See this link for all possible values https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ=Asia/Shanghai
Default spam threshold used for new users
DEFAULT_SPAM_THRESHOLD=80
Nginx配置文件,要改域名
server { listen 80; listen [::]:80; server_name mail.example.com autodiscover.example.com autoconfig.example.com; return 301 https://$host$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name mail.example.com autodiscover.example.com autoconfig.example.com;
ssl_certificate /etc/nginx/ssl/example.com/fullchain.pem; ssl_certificate_key /etc/nginx/ssl/example.com/privkey.pem; ssl_session_timeout 1d; ssl_session_tickets off; ssl_protocols TLSv1.2; ssl_ciphers HIGH:!aNULL:!MD5:!SHA1:!kRSA; ssl_prefer_server_ciphers off;
location ~* ^/(admin|api|sso|static|webdav|webmail|(apple.)?mobileconfig|(.well-known/autoconfig/)?mail/|Autodiscover/Autodiscover) { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_pass https://localhost:44443; }
location / { return 301 $scheme://$host/webmail; }
location /admin { proxy_pass https://localhost:44443/admin; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; }
location /webmail { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_pass https://127.0.0.1:44443/webmail; } access_log /www/wwwlogs/mail.example.com.log main; error_log /www/wwwlogs/error/mail.example.com.error.log; }
启动
docker compose up -d 启动, nginx -s reload nginx加载配置
docker compose exec admin flask mailu admin admin example.com 'password' 命令创建一个用户名 [email protected] 密码 password 的管理员账户,访问 mail.example.com 登录即可
DNS解析相关
mail.example.com 解析到 IP
进入 https://mail.example.com/admin/domain/details/example.com 里面有剩余的所有要添加的解析
vps面板或工单把IP反向解析 (rDNS) 到 mail.example.com
vps 主机名称改为 mail,包括 hostnamectl set-hostname mail 和改 /etc/hosts
效果
webmail 是这样的
剩余的所有要添加的解析是这些
评分
1 0 22 引用 回复
1 2
Javaow 79days ago #1
得这么多镜像吗,数了下有10个镜像,多大内存能跑起来
❤️☀️❤️★❤️☀️❤️★❤️☀️❤️★❤️☀️❤️★❤️☀️❤️★❤️☀️❤️★❤️☀️❤️★❤️☀️❤️★❤️☀️❤️★❤️
0 0 引用 回复
Guu 楼主 79days ago #2
@Javaow #1 都是些小东西,作者把他们分开了而已,有些内存只占用几M,我算了有一下,近期占用最高623M,平均575M,1C1G小鸡都行。
0 0 引用 回复
Samling 79days ago #3
这web界面和serv00的邮箱一摸一样
来聊天 ~ 一眼顶针
GiffGaff卡需要的来 ~
0 0 引用 回复
Guu 楼主 79days ago #4
@Samling #3 这个是个开源的web邮箱客户端roundcube,估计也用的这个。
0 0 引用 回复
love7899 78days ago #5
搞一个一键脚本,我搞到甲骨文里面去保活呀
0 0 引用 回复
skyxin 70days ago #6
围观
0 0 引用 回复
moreoronce 69days ago #7
占用500多M也不少了。
dolingo | 奈飞合租 AFF | 家宽机场 AFF
0 0 引用 回复
zhang780 69days ago #8
试一下
TG联系
0 0 引用 回复
可汗 临时禁言 69days ago #9
技术贴,但是看着有点复杂
全球IT论坛开放注册了,注册就送“论坛元老徽章”:baidu.do
0 0 引用 回复
cos 69days ago #10
图呢?
RN最佳套餐,1g 20G ssd 4t(可翻倍成8T)10刀 RN历届闪购套餐一览
0 0 引用 回复
1 2
内容 预览 对照
支持 markdown语法
鼓励友善发言,禁止人身攻击
xxxxxxxxxx
1
1
AC娘
洋葱头
小黄鸡
发布评论
88
等级 Lv 4 鸡腿 1907 关注 0 通知 0
主题帖 10 评论数 290 粉丝 2 收藏 182 发帖
快捷功能区 推荐阅读 管理记录 幸运抽奖 邀请好友 合作商家 友站链接
所有版块 日常 技术 情报 测评 交易 曝光 拼车 生活 贴图 推广 内版 Dev 无意义 沙盒
📈用户数目📈
目前论坛共有22061位seeker
🎉欢迎新用户🎉
huotuchensha
alanlu
onvo
无欲无求
相关网站 LowEndTalk LowEndSpirit HostLoc ServerHunter
站内导航 关于本站 隐私协议 RSS订阅 sitemap
商业推广 商家申请规则 Premium Provider 合作商家展示
其他平台 电报频道 电报群组
联系我们
Copyright © 2022 - 2024 All rights Reserved