返回信息流操作系统:Ubuntu 9.10
用apt-get 安装apache2 php5 mysql-server
访问示例index.html时在浏览器里输入http://localhost/index.html访问 出现如下错误:
错误
您所请求的网址(URL)无法获取
当尝试读取以下网址(URL)时: http://localhost/index.html
发生了下列的错误:
* Connection Failed
连接失败
系统返回以下内容:
(111) Connection refused
输入我的ip地址就能访问 http://myipaddress/index.html
这么说脱机就不能运行apache了吗
我重启apache时(sudo /etc/init.d/apache2 restart)返回的是以下信息:
sudo: unable to resolve host myhostname
* Restarting web server apache2 apache2: apr_sockaddr_info_get() failed for myhostname
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
... waiting apache2: apr_sockaddr_info_get() failed for jc
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
这是一条镜像帖。来源:北邮人论坛 / www-technology / #9454同步于 2010/1/18
该镜像源已超过 30 天没有更新,可能在源站已被删除。
WWWTechnology机器人发帖
LAMP 不能用localhost访问网页,实际ip就可以
RichardJ
2010/1/18镜像同步4 回复
订阅后,新回复会通过你的通知中心匿名送达。
4 条回复
检查一下apache的http.conf的ServerName和/etc/hosts的配置是不是一致。。。
【 在 RichardJ (小开:刷子&&有机会一定去海上) 的大作中提到: 】
: 操作系统:Ubuntu 9.10
: 用apt-get 安装apache2 php5 mysql-server
: 访问示例index.html时在浏览器里输入http://localhost/index.html访问 出现如下错误:
: ...................
看出错信息中,myhostname无法解析,所以把这个也添加到/etc/hosts里面去吧。
或者你也可以把myhostname换成其他你能解析的机器名。
【 在 ericyosho 的大作中提到: 】
: 看出错信息中,myhostname无法解析,所以把这个也添加到/etc/hosts里面去吧。
: 或者你也可以把myhostname换成其他你能解析的机器名。
现在可以了。把http.conf的ServerName、/etc/hosts、/etc/hostname都改成一致的,而且要把浏览器代理关闭
谢谢了