默认安装的 httpd 服务并未指定域名,在输入bin/apachectl start 启动 apache 服务时会出现 报错 “httpd: Could not reliably determine the server's fully qualified domain name”。
① 在配置文件 /etc/httpd/conf/httpd.conf 中加入域名
# vim /etc/httpd/conf/httpd.conf
② 找到文件中的 # ServerName www.example.com:80, 修改成你需要指定的域名,或者在下一行添加。端口号不是必须加的。例如:
ServerName www.aurona.com
③ 在配置文件 /etc/hosts 中加入 ip地址与域名
# vim /etc/hosts
打开文件后添加 ip 地址与刚刚指定的域名。ip地址要修改成你自己的,可以用ifconfig查看。
192.168.137.29 www.aurona.com
④ 然后重启 httpd 即可。可以用 systemctl status httpd查看状态。
# systemctl restart httpd
# systemctl status httpd
此时,报错已解决。可以正常启动apache。