在Ubuntu上,每次使用sudo service apache2 reload
命令重新加载apache2服务时,我的终端显示 apache2.service is not active, cannot reload.
并且,我尝试将phpmyadmin添加为虚拟主机,使用phpmyadmin.local
作为本地区域网络域名;有人可以告诉我怎么样?我今天尝试了很多次,我搜索了很多方法,但直到现在,它仍然是404 not found
,
答案 0 :(得分:14)
我遇到了与Ubuntu 16.04相同的问题。这导致了logrotate的问题,因为它在旋转日志后无法重新加载Apache。
我得到的完整错误:
/etc/init.d/apache2 reload
[....] Reloading apache2 configuration (via systemctl): apache2.serviceapache2.service is not active, cannot reload.
failed!
使用apachectl停止Apache并使用/etc/init.d/apache2启动它后,问题就消失了:
apachectl stop
/etc/init.d/apache2 start
您现在可以重新加载Apache:
/etc/init.d/apache2 reload
[ ok ] Reloading apache2 configuration (via systemctl): apache2.service.
如果您使用apachectl start
启动Apache,则不会将其标记为有效服务,因此您无法使用service apache2 reload
重新加载它。您必须使用/etc/init.d/apache2 start
或service apache2 start
启动Apache。
我不确定它的意图或错误。我无法用旧系统重现这一点。
答案 1 :(得分:9)
实际上你应该检查端口80中是否有另一个服务/服务器正在运行:
sudo netstat -tulpn | grep :80
如果它不是apache2,请停止它(对我而言,它是lighttpd所以sudo service lighttpd stop
。
然后启动apache2(sudo service apache2 start
)并享受!