我安装了带有Arch Linux的Raspberry Pi B +,并且在启动时,Apache Web服务器无法启动:
[xxx@rpi ~]# systemctl status -l httpd
* httpd.service - Apache Web Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 1970-01-01 01:00:23 CET; 45 years 0 months ago
Process: 177 ExecStart=/usr/bin/apachectl start (code=exited, status=134)
Jan 01 01:00:23 rpi apachectl[177]: Assertion 'canonical' failed at src/nss-myhostname/nss-myhostname.c:204, function fill_in_hostent(). Aborting.
Jan 01 01:00:23 rpi apachectl[177]: /usr/bin/apachectl: line 79: 185 Aborted (core dumped) $HTTPD -k $ARGV
Jan 01 01:00:23 rpi systemd[1]: httpd.service: control process exited, code=exited status=134
Jan 01 01:00:23 rpi systemd[1]: Failed to start Apache Web Server.
Jan 01 01:00:23 rpi systemd[1]: Unit httpd.service entered failed state.
Jan 01 01:00:23 rpi systemd[1]: httpd.service failed.
Jan 01 01:00:24 rpi systemd-coredump[208]: Process 185 (httpd) of user 0 dumped core.
[xxx@rpi ~]#
但是,如果从ssh终端重新启动apache(在系统重新启动并ssh登录之后),则该apache已正确运行:
[xxx@rpi ~]# systemctl restart httpd && systemctl status -l httpd
* httpd.service - Apache Web Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2015-01-05 02:48:46 CET; 336ms ago
Process: 420 ExecStart=/usr/bin/apachectl start (code=exited, status=0/SUCCESS)
Main PID: 424 (httpd)
CGroup: /system.slice/httpd.service
|-424 /usr/bin/httpd -k start
|-426 /usr/bin/httpd -k start
|-427 /usr/bin/httpd -k start
|-428 /usr/bin/httpd -k start
|-429 /usr/bin/httpd -k start
`-430 /usr/bin/httpd -k start
Jan 05 02:48:44 rpi apachectl[420]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.0.154. Set the 'ServerName' directive globally to suppress this message
Jan 05 02:48:45 rpi systemd[1]: PID file /run/httpd/httpd.pid not readable (yet?) after start.
Jan 05 02:48:46 rpi systemd[1]: Started Apache Web Server.
[xxx@rpi ~]#
发生了什么(正在运行Linux octopustest 3.12.35-1-ARCH #1 PREEMPT Tue Dec 23 07:14:51 MST 2014 armv6l GNU/Linux
内核和Apache/2.4.10
)?
有一个非常简单的解决方案对我有用。它需要编辑/ etc / hosts文件,如果可能的话,总是避免这样做,但是它解决了我遇到的所有问题。如果有人尝试访问Internet并获取信息(包括Apache,Eclipse和其他应用程序),则会发生此错误。有时,这是由应用程序本身的错误引起的,但也可能是本地问题,当您的/ etc / hosts文件缺少程序所需的某些元素时,会导致该问题。
请注意,您将需要管理员访问权限(或成为该sudoers
组的一部分)才能完成其中一些步骤。
首先,使用以下命令打开hosts文件:sudo nano /etc/hosts
。您的主机文件应类似于以下内容,它是我的直接副本:
#
# /etc/hosts: static lookup table for host names
#
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost BEN-PC-ARCH
::1 localhost.localdomain localhost BEN-PC-ARCH
# End of file
请注意,除了将127.0.0.1反映到localhost.localdomain之外,还有第二行执行相同的操作。/etc/hosts
无论出于何种原因,将此文件添加到文件中都可以解决该问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句