如何重启Apache?

我从SLES切换到Ubuntu,现在我想重新启动我的本地服务器。 在SLES中,我使用了:

rcapache2 restart

但这在Ubuntu中似乎不起作用。

我如何重启我的Apache?

解决办法

sudo service apache2 restart的方式,这是从Red Hat那里借用的。

评论(4)
sudo /etc/init.d/apache2 restart

当然,你可以把 "重启 "换成 "停止"、"开始 "和(我想)"重载"。

评论(3)

如果你是root。(在Ubuntu中,root是被禁用的,我想,比起使用'sudo'命令!)

$ /etc/init.d/apache stop
$ /etc/init.d/apache start
$ /etc/init.d/apache restart
$ /etc/init.d/apache reload 

(如果你使用了a2ensite或a2dissite,你必须重新加载你的apache配置)

评论(6)