在Ubuntu上重新启动Apache2失败

6
当我尝试从Ubuntu重启Apache服务器时,它显示为失败... 我输入了以下命令:$service apache2 restart
它显示为:
Restarting web server apache2 [fail]
当我在var/apache2/errorlog中检查时,提供的描述是:
[mpm_prefork:notice] [pid 1263] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5已配置--恢复正常操作
4个回答

8

很可能是因为您在运行命令时没有使用sudo,尝试以下命令:

sudo service apache2 restart

0
  1. 在Linux/Ubuntu上,我们可以重启Apache服务器:

    sudo service apache2 restart
    
  2. 另一种方式是:

    sudo service apache2 reload
    

0

Debian / Ubuntu Linux 特定命令 在 Debian Linux 版本 7.x 或 Ubuntu Linux 版本 Ubuntu 14.10 或更早版本中,您可以使用以下 service 命令或 /etc/init.d/ 命令:

重启 Apache 2 web 服务器,请输入:

# /etc/init.d/apache2 restart

或者

$ sudo /etc/init.d/apache2 restart

或者

$ sudo service apache2 restart

停止 Apache 2 Web 服务器,请输入:

# /etc/init.d/apache2 stop

或者

$ sudo /etc/init.d/apache2 stop

或者

$ sudo service apache2 stop

启动 Apache 2 网络服务器,请输入:

# /etc/init.d/apache2 start

或者

$ sudo /etc/init.d/apache2 start

或者

$ sudo service apache2 start

关于Debian/Ubuntu Linux systemd用户的说明 在Debian Linux版本8.x+或Ubuntu Linux版本Ubuntu 15.04+或更高版本上使用以下命令:

启动命令

systemctl start apache2.service

停止命令

systemctl stop apache2.service

重启命令

systemctl restart apache2.service

CentOS/RHEL (Red Hat) Linux 版本 4.x/5.x/6.x 或更早的特定命令

开始

service httpd start

停止

service httpd stop

重新启动

service httpd restart

CentOS/RHEL(Red Hat)Linux 版本 7.x 或更新版本的特定命令

现在大多数现代发行版都使用 systemd,因此您需要使用以下命令:

启动命令

systemctl start httpd.service

停止指令

systemctl stop httpd.service

重启命令

systemctl restart httpd.service

在Linux/Unix上启动/停止/重新启动Apache的通用方法 语法如下(必须以root用户身份运行):

停止它

apachectl -k stop

重新启动它

apachectl -k restart

优雅重启它

apachectl -k graceful

开始吧

apachectl -f /path/to/your/httpd.conf
apachectl -f /usr/local/apache2/conf/httpd.conf

如果其他服务占用了80端口(例如:Skype),

请尝试以下代码:

sudo /etc/init.d/apache2 stop

代码如下:

sudo killall apache2

然后确保端口80上没有运行任何服务 代码:

sudo netstat -l|grep www

然后重新启动Apache代码:

sudo /etc/init.d/apache2 restart

0

尝试停止Apache服务器,然后重新启动。 在Ubuntu终端中输入命令

sudo apachectl stop

然后再次启动Apache服务器


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接