关于ubuntu Apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
最近在本地虚拟机上安装ubun系统,并打算安装lamp环境,跑一下自己的小项目,但在配置过程中发现重启Apache时提示:Apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName。
于是查找了一下解决方法:
在apache的配置文件:
sudo gedit /etc/apache2/httpd.conf
里面加一行ServerName localhost就OK了;若该文件没有或空则添加一个就可以。
然后我重启apache,发现还是提示这个错误,又百度了一番,发现是apache的默认配置文件apache2.conf中没有引用这个httpd.conf配置文件。
解决办法是在include httpd.conf这个文件:
sudo gedit /etc/apache2/apache2.conf
找到
# Include module configuration: Include /etc/apache2/mods-enabled/*.load Include /etc/apache2/mods-enabled/*.conf …… # Include ports listing Include ports.conf …… # Include generic snippets of statements Include conf.d/ …… # Include the virtual host configurations: Include sites-enabled/
这些语句随便哪里插入:
# Include all the user configurations: Include httpd.conf

浙公网安备 33010602011771号