[英]Apache2 restart fail with error: "Apache2: bad user name: USERNAME
[英]$ service apache2 restart [fail]
我已经在我的 Ubuntu 服务器上安装了 Apache。 出于特殊原因,我必须在其上启用 mod_rewrite。 所以我做了这个。
在互联网上的每个教程中,最后一个命令是重新启动 apache。 但是当我这样做时,控制台会打印[fail].
有人能帮我一下吗?
$ service apache2 restart
* Restarting web server apache2 [fail]
我有一个类似的问题,对我来说这是关于登录用户没有权限所以而不是
service apache2 restart
我必须做
sudo service apache2 restart
它告诉您一些其他服务已经在端口 80 上,也许是 apache
尝试代码:
sudo /etc/init.d/apache2 stop
其次是代码:
sudo killall apache2
然后确保没有服务在端口 80 上运行代码:
sudo netstat -l|grep www
然后(重新)启动 apache 代码:
sudo /etc/init.d/apache2 restart
使用 systemd 功能(从 Ubuntu 15 开始),您可以按如下方式重新启动 apache 服务:
sudo systemctl restart apache2.service
检查状态:
sudo systemctl status apache2.service
这有多种原因。
service apache2 status
检查service apache2 status
...失败! 这意味着它没有运行您可以通过命令service apache2 start
或sudo service apache2 start
PID
文件cat /var/run/apache2/apache2.pid
这将为您提供 apache 的进程 ID 这意味着您的系统意外关闭而不删除PID
文件,所以通过以下命令删除rm - rf/var/run/apache2/apache2.pid
或sudo rm -rf/var/run/apache2/apache2.pid
并通过以下命令重新启动服务器service apache2 start
或sudo service apache2 start
当我向托管在 Digital Ocean Cloud 服务中的 Web 服务器添加新网站时,我遇到了这个问题。 所以发生的事情是,当我使用 sudo 命令重新启动或重新加载 apache2 服务器时,它的重新字符串带有以下错误消息。
尽管有这两条错误消息,但对我来说一切都运行良好。
所以修复非常简单。
首先打开您的 hotsts 文件。
须藤纳米 /etc/hosts
输出文件
127.0.1.1 主机名 127.0.0.1 本地主机
须藤纳米 /etc/hostname
输出文件
主机名xxx
尝试以下命令重新启动。
# /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 Web 服务器,请输入:
# /etc/init.d/apache2 start
或者
$ sudo /etc/init.d/apache2 start
或者
$ sudo service apache2 start
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.