【问题标题】:How to resolve chown: invalid user while starting apache server? [closed]启动apache服务器时如何解决chown:无效用户? [关闭]
【发布时间】:2021-03-19 11:50:19
【问题描述】:

我正在尝试通过运行来启动 apache2 服务-

sudo service apache2 start

但结果是——

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

我试过了-

sudo systemctl status apache2.service

它正在显示-

● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2020-12-08 11:17:18 IST; 7min ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 30529 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Dec 08 11:17:18 dk systemd[1]: Starting The Apache HTTP Server...
Dec 08 11:17:18 dk apachectl[30535]: chown: invalid user: 'dk'
Dec 08 11:17:18 dk systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Dec 08 11:17:18 dk systemd[1]: apache2.service: Failed with result 'exit-code'.
Dec 08 11:17:18 dk systemd[1]: Failed to start The Apache HTTP Server.

我假设问题出在无效用户:dk。我该如何解决这个问题? 我最近还删除了一个已经安装了 LAMP 堆栈的用户帐户。这就是它显示无效用户的原因吗?

【问题讨论】:

  • Stack Overflow 用于编程问题。您可以尝试在 Unix & LinuxServer FaultSuper User 上提问。
  • @JohnKugelman 感谢您的建议。我会尝试在这些网站上提问。

标签: linux apache lamp


【解决方案1】:

你必须在文件中看到: /etc/apache2/apache2.conf 要么 /etc/apache2/httpd.conf

  • 输入的用户和组是什么

通常是:

User www-data
Group www-data

或者在你的情况下它是“dk”

此外,您可能已在服务器文件中指定站点位置位于“dk”拥有的目录中。

使用命令检查服务器配置:

apachectl configtest

sudo apachectl configtest

【讨论】:

  • apachectl configtest 返回chown: invalid user: 'dk'
【解决方案2】:

在新系统中,例如ubuntu 20 * LTS,配置文件为/etc/apache2/envvars

查找 APACHE_RUN_USER 和 APACHE_RUN_GROUP。

【讨论】:

  • 是的,RUN_USER 和 RUN_GROUP 设置为 dk。我应该将其更改为 www-data
  • 我将其更改为 www-data 并且现在可以使用。谢谢您的帮助。 :)
  • 酷 - 能帮上忙真是太好了
猜你喜欢
  • 2020-09-17
  • 2020-10-16
  • 1970-01-01
  • 1970-01-01
  • 2020-09-27
  • 2018-05-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多