您的位置:首页 > 运维架构 > Apache

Ubuntu安装Apache服务器

2016-05-11 17:23 585 查看
安装apache,在命令行终端中输入一下命令:

$ sudo apt-get install apache2

安装完成后,重启apache服务,在命令行终端中输入一下命令:

$ sudo /etc/init.d/apache2 restart

可能会出现的问题1: NameVirtualHost *:80 has no VirtualHosts,如下截图



出现上述问题的原因:定义了多个NameVirtualHost,故将/etc/apache2/ports.conf中的NameVirtualHost *:80注释掉即可。

或者将80端口换成其他端口如:5000

可能会出现的问题2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName



错误信息:

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

原因:

根据提示,无法可靠的确定服务器的有效域名,使用127.0.1.1作为服务器域名。应此,在下面的测试中,应该使用127.0.1.1,而不是127.0.0.1!

解决方法:

sudo gedit /etc/apache2/apache2.conf

在文件后面加上:

#Server Name

ServerName 127.0.0.1
错误信息:

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: