为了解决一些电子邮件(SPF)问题,我在/etc/hosts和/etc/hostname中将Ubuntu主机名更改为FQDN。然而,现在,当我在浏览器中点击URL时,我从Apache获得404,而不是触发/etc/apache2/sites-available/example.com中的块,这将重定向到站点的www版本。输入www.example.com仍然有效。
我的主机文件现在看起来如下:127.0.0.1 localhost 256.256.256.256 example.com # I am using a real IP and FQDN, obviously
我不知道为什么Apache会提供404。上面写着The requested URL / cannot be found on this server和其他什么都没有。为什么要编辑我的hosts文件呢?
发布于 2018-02-05 21:49:51
这个问题实际上出现在默认的Apache配置文件(/etc/apache2/sites-available/000-default.conf)中。
取消该行的注释:
#ServerName example.com并添加服务器的FQDN (完全限定域名)。
最后,运行sudo service apache2 reload,让Apache对配置文件进行更改。
https://askubuntu.com/questions/1003369
复制相似问题