I am trying to start apache2 services by running-
sudo service apache2 start
But it is resulting in-
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
I tried-
sudo systemctl status apache2.service
and it’s showing-
● 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.
I am assuming the problem is with invalid user: dk. How can i resolve this?
Also I recently removed one user account which already had LAMP stack installed. Is that the reason why it’s showing invalid user?
2
Answers
You must see in the file:
/etc/apache2/apache2.conf
or
/etc/apache2/httpd.conf
normally it is:
or maybe in your case it is "dk"
in addition, you may have specified in the server file that the site location is in a directory owned by "dk".
Check the server configuration with the command:
or
In new systems, e.g. ubuntu 20 * LTS, the configuration file is
/etc/apache2/envvars
look for APACHE_RUN_USER and APACHE_RUN_GROUP.