Ubuntu Apache 重启失败 Could not reliably determine the server's...

报错信息

这里写图片描述
解决办法

进入目录 /etc/apache2

编辑 apache2.conf 配置文件 ,
输入命令 :

sudo vim apache2.conf

在文件末尾加下面命令

1.ServerName localhost:80  
2.DirectoryIndex index.html index.htm index.php  
3.AddDefaultCharest GB2312

编辑后保存,重启apache即可。

注释:

  • ServerName localhost:80 是为了防止最后开启apache2服务的时候会提示DNS出错。
  • DirectoryIndex index.html index.htm index.php 是默认目录的写法
  • AddDefaultCharset GB2312 设置默认字符集,定义服务器返回给客户机默认字符集(由于西欧UTF-8是Apache默认字符集,因此当访问有中文的网页时会出现乱码,这时只要将字符集改成GB2312
  • 更改此配置文件的关键是加入 ServerName localhost:80 这条语句是必须的,否则开启apache2服务的时候会提示DNS出错。其他两条语句也可以选择不加。

猜你喜欢

转载自blog.csdn.net/qq_38125058/article/details/79930391
今日推荐