Postfix 配置 CentOS 7

Postfix 配置 CentOS 7

为了在我的 CentOS 7 服务器上配置 Postfix 服务,我编辑了/etc/posfix/main.cf并提供了所有必需的参数。重启后显示以下错误:

[root@centos-s-1vcpu-3gb-ams3-01 ~]# sudo systemctl status postfix
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2018-04-18 02:51:26 UTC; 32min ago
  Process: 11874 ExecStop=/usr/sbin/postfix stop (code=exited, status=1/FAILURE)
  Process: 4912 ExecStart=/usr/sbin/postfix start (code=exited, status=1/FAILURE)
  Process: 4910 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 4907 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=75)
 Main PID: 973 (code=killed, signal=TERM)

Apr 18 02:51:25 centos-s-1vcpu-3gb-ams3-01 postfix/sendmail[4909]: warning: valid_hostname: invalid character 32(decimal): centos-s-1vcpu-3gb-ams3-01  mydoma...es = all
Apr 18 02:51:25 centos-s-1vcpu-3gb-ams3-01 aliasesdb[4907]: newaliases: warning: valid_hostname: invalid character 32(decimal): centos-s-1vcpu-3gb-ams3-01  m...es = all
Apr 18 02:51:25 centos-s-1vcpu-3gb-ams3-01 aliasesdb[4907]: newaliases: fatal: file /etc/postfix/main.cf: parameter myhostname: bad parameter value: centos-s...es = all
Apr 18 02:51:25 centos-s-1vcpu-3gb-ams3-01 postfix/sendmail[4909]: fatal: file /etc/postfix/main.cf: parameter myhostname: bad parameter value: centos-s-1vcp...es = all
Apr 18 02:51:25 centos-s-1vcpu-3gb-ams3-01 postfix[4912]: warning: valid_hostname: invalid character 32(decimal): centos-s-1vcpu-3gb-ams3-01  mydomain = livs...es = all
Apr 18 02:51:25 centos-s-1vcpu-3gb-ams3-01 postfix[4912]: fatal: file /etc/postfix/main.cf: parameter myhostname: bad parameter value: centos-s-1vcpu-3gb-ams...es = all
Apr 18 02:51:26 centos-s-1vcpu-3gb-ams3-01 systemd[1]: postfix.service: control process exited, code=exited status=1
Apr 18 02:51:26 centos-s-1vcpu-3gb-ams3-01 systemd[1]: Failed to start Postfix Mail Transport Agent.
Apr 18 02:51:26 centos-s-1vcpu-3gb-ams3-01 systemd[1]: Unit postfix.service entered failed state.
Apr 18 02:51:26 centos-s-1vcpu-3gb-ams3-01 systemd[1]: postfix.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@centos-s-1vcpu-3gb-ams3-01 ~]#

我已经将系统的主机名更改为 smtp.livsite.com,但它也显示错误,所以我回到了初始阶段。我该如何解决这个错误?

答案1

在您的后缀警告中:

warning: valid_hostname: invalid character 32(decimal)

告诉我们主机名包含空格字符(十进制为 0x20 = 32)。请检查您的主机名配置是否使用了空格字符。

另一个抱怨:

fatal: file /etc/postfix/main.cf: parameter myhostname: bad parameter value: centos-s-1vcpu-3gb-ams...es = all

还会抱怨 /etc/postfix/main.cf 中的 myhostname。

检查并尝试: myhostname = centos-s-1vcpu-3gb-ams3-01.$mydomain

或者将 $mydomain 替换为以下固定字符串:

myhostname = centos-s-1vcpu-3gb-ams3-01.your.domain

相关内容