近期安装了两次httpd服务,重启httpd服务是卡住,查看状态发现:could not reliably determine the server's fully qualif domain name。

服务httpd启动卡住,报错domain name

主机系统环境:centos7.6

安装:yum  install httpd

配置:未作任何修改,直接启动服务

启动服务: systemctl  start  httpd

问题现象:启动httpd服务时卡住,且无法启动服务

正在启动httpd:httpd:could not reliably determine the server's fully qualif domain name,using::1 for servername

正在启动httpd:httpd:could not reliably determine the server's fully qualif domain name,
using::1 for servername

启动httpd服务卡住_启动httpd卡

解决方法:修改配置--注释 #ServerName www.example.com:80

启动httpd服务卡住_启动httpd卡_02

改成  ServerName   localhost:80     ##去掉前面的注释符号

启动httpd服务卡住_httpd中Alias配置_03

重启httpd成功

启动httpd服务卡住_启动httpd卡_04


别名网页配置

查看http版本

Server version: Apache/2.4.6 (CentOS)

Server built:   Mar 24 2022 14:57:57

别名配置的目录/etc/httpd/conf.d目录下有一个配置文件autoindex.conf

通过修改autoindex.conf中Alias关键字进行别名配置。如默认配置中例子

21 Alias /icons/ "/usr/share/httpd/icons/"
22 
23 <Directory "/usr/share/httpd/icons">
24     Options Indexes MultiViews FollowSymlinks
25     AllowOverride None
26     Require all granted
27 </Directory>

启动httpd服务卡住_httpd中Alias配置_05

复制这几行,创建新的目录进行配置,例如

Alias /mytest/ "/shared_dir/"

<Directory "/shared_dir/">
    Options Indexes MultiViews FollowSymlinks
    AllowOverride None
    Require all granted
</Directory>

启动httpd服务卡住_httpd中Alias配置_06

测试验证  访问ip地址下的目录mytest。  http://10.195.52.4/mytest/

启动httpd服务卡住_httpd中Alias配置_07



redhat替换yum源时redhat.repo无法删除或禁用的问题

在替换自带的repo源时发现无论是将redhat.repo重命名还是删除,在执行yum命令后总是自动又生成redhat.repo得问题,导致替换的redhat.repo,一直无法使用的。

执行yum命令后,查看yum.repos.d/目录下刚刚重命名为redhat.repo.bak的repo又自动生成了一个redhat.repo

redhat自带的插件subscription-manager给弄得的。

解决办法:找到subscription-manage的配置文件/etc/yum/pluginconf.d/subscription-manager.conf,把enabled的值改为0