在进行一些更改后,我的Apache不会重新加载,在这种情况下,通过Webmin添加一个新的VHOST后。 这不是第一次发生,上次我解决了重新安装Apache,确实不是一个令人满意的方式来解决问题。
在Webmin中,我得到这个错误
Failed to start apache : : Starting apache2 (via systemctl): apache2.service.
所以我尝试重新加载Apache与ssh手动
这是发生了什么事
root@myvps:/# /etc/init.d/apache2 reload Reloading apache2 configuration (via systemctl): apache2.serviceJob for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details. failed!
所以这是journalctl -xn的回应
Jan 04 08:55:51 myvps systemd[1]: Reload failed for LSB: Apache2 web server. -- Subject: Unit apache2.service has finished reloading its configuration -- Defined-By: systemd -- Support: lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit apache2.service has finished reloading its configuration -- -- The result is failed. Jan 04 08:56:01 myvps CRON[3403]: pam_unix(cron:session): session opened for user root by (uid=0) Jan 04 08:56:01 myvps CRON[3404]: (root) CMD (cd / && run-parts --report /etc/cron.hourly) Jan 04 08:56:01 myvps CRON[3403]: pam_unix(cron:session): session closed for user root Jan 04 08:56:02 myvps systemd[1]: Reloading LSB: Apache2 web server. -- Subject: Unit apache2.service has begun with reloading its configuration -- Defined-By: systemd -- Support: freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit apache2.service has begun with reloading its configuration Jan 04 08:56:02 myvps systemd[1]: Failed to reset devices.list on /system.slice/apache2.service: No such file or directory Jan 04 08:56:03 myvps apache2[3420]: Reloading web server: apache2 failed! Jan 04 08:56:03 myvps apache2[3420]: Apache2 is not running ... (warning). Jan 04 08:56:03 myvps systemd[1]: apache2.service: control process exited, code=exited status=1 Jan 04 08:56:03 myvps systemd[1]: Reload failed for LSB: Apache2 web server. -- Subject: Unit apache2.service has finished reloading its configuration -- Defined-By: systemd -- -- Unit apache2.service has finished reloading its configuration -- -- The result is failed.
这是systemctl状态apache2.service之一
Jan 04 09:23:43 myvps apache2[3819]: Action 'start' failed. Jan 04 09:23:43 myvps apache2[3819]: The Apache error log may have more information. Jan 04 09:23:43 myvps apache2[3819]: . Jan 04 09:23:43 myvps systemd[1]: Started LSB: Apache2 web server. -- Subject: Unit apache2.service has finished start-up -- Defined-By: systemd -- Support: lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit apache2.service has finished starting up. -- -- The start-up result is done. Jan 04 09:24:03 myvps systemd[1]: Reloading LSB: Apache2 web server. -- Subject: Unit apache2.service has begun with reloading its configuration -- Defined-By: systemd -- -- Unit apache2.service has begun with reloading its configuration Jan 04 09:24:03 myvps systemd[1]: Failed to reset devices.list on /system.slice/apache2.service: No such file or directory Jan 04 09:24:03 myvps apache2[3868]: Reloading web server: apache2 failed! Jan 04 09:24:03 myvps apache2[3868]: Apache2 is not running ... (warning). Jan 04 09:24:03 myvps systemd[1]: apache2.service: control process exited, code=exited status=1 Jan 04 09:24:03 myvps systemd[1]: Reload failed for LSB: Apache2 web server. -- Subject: Unit apache2.service has finished reloading its configuration -- Defined-By: systemd -- -- Unit apache2.service has finished reloading its configuration -- -- The result is failed.
这些是VPS的特点
来自Apache错误日志的一些其他细节:
[Mon Jan 04 05:16:05.615503 2016] [mpm_event:notice] [pid 367:tid 140186227066752] AH00489: Apache/2.4.10 (Debian) OpenSSL/1.0.1k configured -- resuming normal operations [Mon Jan 04 05:16:05.615527 2016] [core:notice] [pid 367:tid 140186227066752] AH00094: Command line: '/usr/sbin/apache2' [Mon Jan 04 06:22:05.208150 2016] [core:error] [pid 428:tid 140185949918976] [client clientIP:clientPort] AH00135: Invalid method in request quit [Mon Jan 04 08:34:33.316012 2016] [mpm_event:notice] [pid 367:tid 140186227066752] AH00493: SIGUSR1 received. Doing graceful restart (98)Address already in use: AH00072: make_sock: could not bind to address vhostIp:vhostPort [Mon Jan 04 08:34:33.343511 2016] [mpm_event:alert] [pid 367:tid 140186227066752] no listening sockets available, shutting down [Mon Jan 04 08:34:33.343518 2016] [:emerg] [pid 367:tid 140186227066752] AH00019: Unable to open logs, exiting
我的apache2.conf http://pastebin.com/xcedmPi0
我的VirtualHostconfiguration文件 000-default.conf http://pastebin.com/QYgMtTaK
webmin.conf pastebin.com/wFAe1uyS
任何人都可以帮忙?
谢谢。
它看起来像错误日志,你有错误configuration你的虚拟主机或重复Listen 80条目在你的Apacheconfiguration文件。
(98)已经在使用的地址:AH00072:make_sock:无法绑定到地址vhostIp:vhostPort
在默认的虚拟主机configuration文件中,尝试将<VirtualHost *>更改为<VirtualHost *:80>并重新启动apache。 对于基于名称的虚拟主机,您不需要指定IP地址。
另外检查你的/etc/apache2/ports.conf文件是否有重复的端口声明条目。
从OP中更新:通过在ports.conf中删除一行解决了问题<IfModule ssl_module> Listen 443 Listen vpsIp:5673 (在失败的vhost创build期间由Webmin添加的行)
Webmin往往会从我的经验中产生不正确的Apache vHostconfiguration。 configuration文件会显示类似的东西
VirtualHost 127.0.0.1:80
或者无论你的IP地址是什么。 随你怎么便
VirtualHost *:80
用星号代替IP。
这个问题已经在Webmin一段时间了,我不确定他们为什么没有修复它。 最好是手动编写configuration,或者使用替代的WebCP,比如Ajenti。