gentoo apache2 启动失败解决

安装 apache2 后,启动总是错误

sunshine@gentoo /etc/apache2 $ sudo /etc/init.d/apache2 start

 * Starting apache2 ...

apache2: apr_sockaddr_info_get() failed for gentoo

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

 * start-stop-daemon: failed to start `/usr/sbin/apache2'

                                                                                                               [ ok ]

 

用 strace 跟踪也找不到问题

去看 apache2 的log 

tail -f /var/log/apache2/error_log

[Sun Oct 30 20:29:34 2011] [alert] (EAI 3)Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of "gentoo"

Configuration Failed

google之,最后锁定问题关键,gentoo 这个hostname找不到ip地址..

操蛋,怎么也想不到这里有问题

sunshine@gentoo /var/log/apache2 $ hostname 

gentoo

hostname 果然是gentoo,当时配置的时候想要让别人在网络上知道我是用的gentoo,所以用的这个名字。

所以在 /etc/hosts 中加入 gentoo 别名对应的本机ip就ok了

sunshine@gentoo ~ $ cat /etc/hosts

127.0.0.1       gentoo localhost localhost.localdomain localhost4 localhost4.localdomain4

::1             gentoo localhost localhost.localdomain localhost6 localhost6.localdomain6

再启动apache2就正常了,感谢google,和apache的log。

tail -f /var/log/apache2/error_log

[Sun Oct 30 20:33:48 2011] [notice] Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/1.0.0e configured -- resuming normal operations



你可能感兴趣的:(apache,server,unix,Google,domain,sun)