Ubuntu '无法重新启动apache2.service:未找到单元apache2.service,'

cnh2zyt3  于 2023-04-07  发布在  Apache
关注(0)|答案(5)|浏览(233)

我正在使用Google Cloud Platform来测试ModSecurity,并使用教程来启动它。但是,我需要每隔一段时间重新启动Apache。我使用的是Ubuntu 18.04。我编写sudo systemctl restart apache2,但返回一个错误,它显示Failed to restart apache2.service: Unit apache2.service not found。我应该怎么做?

ruarlubt

ruarlubt1#

你是不是先安装了apache2?

sudo apt install apache2
nwsw7zdq

nwsw7zdq2#

对于使用Debian遇到同样问题的用户

我确实安装并运行了apache2,apache2.service | loaded active running证实了这一点。

我仍然试图安装它。

我也得到了同样的错误Failed to restart apache2.service: Unit apache2.service not found

如何重启apache2

使用:Debian(9.13)

sudo service apache2 restart

或通过键入

sudo apachectl stop
sudo apachectl start
sqougxex

sqougxex3#

输入sudo apt install apache2
启动apache服务类型
sudo systemctl start apache2

qyyhg6bp

qyyhg6bp4#

对于Arch Linux,必须启动httpd.service

3qpi33ja

3qpi33ja5#

如果你尝试安装它,仍然有同样的问题,你可以更新它,尝试:apt-get更新

相关问题