Failed to start The Apache HTTP Server - apache

Server is Cent OS.
The httpd was working properly that is why I shut down the whole server to take snapshot. After the reboot the httpd was not working anymore, here is error from jorunalctl:
-- Unit httpd.service has begun starting up.
Mar 16 12:47:49 ragnar01.novalocal httpd[2350]: httpd (pid 2322) already running
Mar 16 12:47:49 ragnar01.novalocal kill[2351]: kill: cannot find process ""
Mar 16 12:47:49 ragnar01.novalocal systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 16 12:47:49 ragnar01.novalocal systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Mar 16 12:47:49 ragnar01.novalocal systemd[1]: Unit httpd.service entered failed state.
Mar 16 12:47:49 ragnar01.novalocal systemd[1]: httpd.service failed.
Mar 16 12:47:49 ragnar01.novalocal polkitd[779]: Unregistered Authentication Agent for unix-process:2335:24998 (system bus name :1.13, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Mar 16 12:48:00 ragnar01.novalocal sshd[2332]: Connection closed by 123.183.209.139 [preauth]
I will be glad for all the ideas to start it again.

Related

Failed to start The Apache HTTP Server After Update Directadmin

My webserver down and cant run it again After update Directadmin
[root#srv ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/etc/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: signal) since Tue 2020-06-30 10:41:18 +0430; 1min 17s ago
Process: 1363 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=killed, signal=KILL)
Main PID: 1363 (code=killed, signal=KILL)
Jun 30 09:52:24 srv.shahriariboresh.ir systemd[1]: Starting The Apache HTTP Server...
Jun 30 10:41:13 srv.shahriariboresh.ir systemd[1]: httpd.service start operation timed out. Terminating.
Jun 30 10:41:18 srv.shahriariboresh.ir systemd[1]: httpd.service stop-sigterm timed out. Killing.
Jun 30 10:41:18 srv.shahriariboresh.ir systemd[1]: httpd.service: main process exited, code=killed, status=9/KILL
Jun 30 10:41:18 srv.shahriariboresh.ir systemd[1]: Failed to start The Apache HTTP Server.
Jun 30 10:41:18 srv.shahriariboresh.ir systemd[1]: Unit httpd.service entered failed state.
Jun 30 10:41:18 srv.shahriariboresh.ir systemd[1]: httpd.service failed.
any body help me for solve this problem ?

Apache Won't Start after Adding SSL Certificates

Hello so here is the problem
I have generated CSR on CentOS and purchased SSL on Comodo.
I have added following lines to ssl.conf
ServerName mydomain.com
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateKeyFile /etc/pki/tls/certs/mydomain.key
SSLCertificateFile /etc/pki/tls/certs/mydomain.crt
SSLCACertificateFile /etc/pki/tls/certs/mydomainCA.crt
and following lines to httpd.conf
<VirtualHost *:80>
ServerName thedomain.com
Redirect "/" "https://thedomain.com/"
</VirtualHost>
After this when I do systemctl restart httpd it gives me following error:
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl
-xe" for details.
and when I check journalctl -xe for details this is what it reads:
-- Subject: Unit httpd.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit httpd.service has finished starting up.
-- The start-up result is done. Nov 24 18:36:01 MyWay polkitd[568]: Unregistered Authentication Agent for unix-process:6639:684652621
(system bus name :1.4409, object path
/org/freedesktop/PolicyKit1/AuthenticationAgent, locale e Nov 24
18:36:04 MyWay sshd[6652]: Invalid user oracle from 80.241.211.237
port 54600 Nov 24 18:36:04 MyWay sshd[6652]: input_userauth_request:
invalid user oracle [preauth] Nov 24 18:36:04 MyWay sshd[6652]:
pam_unix(sshd:auth): check pass; user unknown Nov 24 18:36:04 MyWay
sshd[6652]: pam_unix(sshd:auth): authentication failure; logname=
uid=0 euid=0 tty=ssh ruser= rhost=vmi306916.contaboserver.net Nov 24
18:36:06 MyWay sshd[6652]: Failed password for invalid user oracle
from 80.241.211.237 port 54600 ssh2 Nov 24 18:36:06 MyWay sshd[6652]:
Received disconnect from 80.241.211.237 port 54600:11: Normal
Shutdown, Thank you for playing [preauth] Nov 24 18:36:06 MyWay
sshd[6652]: Disconnected from 80.241.211.237 port 54600 [preauth] Nov
24 18:36:16 MyWay sshd[6651]: Received disconnect from 112.85.42.94
port 31545:11: [preauth] Nov 24 18:36:16 MyWay sshd[6651]:
Disconnected from 112.85.42.94 port 31545 [preauth] Nov 24 18:36:18
MyWay polkitd[568]: Registered Authentication Agent for
unix-process:6655:684654361 (system bus name :1.4410
[/usr/bin/pkttyagent --notify-fd 5 --fallback], object path
/org/freedes Nov 24 18:36:18 MyWay systemd[1]: Stopping The Apache
HTTP Server...
-- Subject: Unit httpd.service has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit httpd.service has begun shutting down. Nov 24 18:36:19 MyWay systemd[1]: Stopped The Apache HTTP Server.
-- Subject: Unit httpd.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit httpd.service has finished shutting down. Nov 24 18:36:19 MyWay systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit httpd.service has begun starting up. Nov 24 18:36:19 MyWay systemd[1]: httpd.service: main process exited, code=exited,
status=1/FAILURE Nov 24 18:36:19 MyWay kill[6667]: kill: cannot find
process "" Nov 24 18:36:19 MyWay systemd[1]: httpd.service: control
process exited, code=exited status=1 Nov 24 18:36:19 MyWay systemd[1]:
Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit httpd.service has failed.
-- The result is failed. Nov 24 18:36:19 MyWay systemd[1]: Unit httpd.service entered failed state. Nov 24 18:36:19 MyWay systemd[1]:
httpd.service failed. Nov 24 18:36:19 MyWay polkitd[568]: Unregistered
Authentication Agent for unix-process:6655:684654361 (system bus name
:1.4410, object path /org/freedesktop/PolicyKit1/AuthenticationAgent,
locale e [
So I have checked lot os solutions but this problems still exists, please note that when I comment out all changes in httpd.conf and ssl.conf apache starts working back normally.
Thanks all in advance
SOLVED
Renaming file to PEM helped the case, besides this I came across some other issues that were causing error ( looking ata apache logs helped me to solv them )
Memory for apache was full so I had to increase it.
I had duplicated SSLCertificateKeyFile in the ssl.conf file and I commented out the default file link.

apache2.service: Failed to run 'start' task: No such file or directory

I can't start my apache server on debian 9.
I tried reinstall :
sudo apt-get autoremove --purge apache2 && sudo apt-get install apache2
but no change...
Job for apache2.service failed because of unavailable resources or another system error.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "restart" failed.
systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: resources)
journalctl -xeu apache2.service
(I set loglevel to debug mod)
Sep 05 11:45:44 systemd[1]: apache2.service: Failed with result 'resources'.
Sep 05 11:50:26 systemd[1]: apache2.service: Changed dead -> failed
Sep 05 11:50:27 systemd[1]: apache2.service: Trying to enqueue job apache2.service/stop/replace
Sep 05 11:50:27 systemd[1]: apache2.service: Installed new job apache2.service/stop as 1415
Sep 05 11:50:27 systemd[1]: apache2.service: Enqueued job apache2.service/stop as 1415
Sep 05 11:50:27 systemd[1]: apache2.service: Job apache2.service/stop finished, result=done
Sep 05 11:50:27 systemd[1]: apache2.service: Changed dead -> failed
Sep 05 11:50:30 systemd[1]: apache2.service: Failed to run 'start' task: No such file or directory
Sep 05 11:50:30 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit apache2.service has failed.
--
-- The result is failed.
Sep 05 11:50:30 systemd[1]: apache2.service: Failed with result 'resources'.
what's wrong?
Maybe this is a problem with service 'tmp' directory. I has a similar error with systemd-resolved.service, and reason was missing '/var/tmp' directory after system migration. Check what temp directory the service is using and create it if necessary.
Also, if there is systemd newly running and crap in /var/tmp/, you might have to clear up this crap and try running the service again.
In my case it turned out to be this (without apache2 running at the time):
root#www:/var/tmp # ls -al
total 32
drwxrwxrwt 8 root root 4096 Dec 15 12:48 .
drwxr-xr-x 14 root root 4096 Jul 8 21:43 ..
drwx------ 2 root root 4096 Dec 15 12:48 systemd-private-1dcdfe608b6c41f387936225d86126c7-apache2.service-L0KeaS
drwx------ 2 root root 4096 Dec 8 03:09 systemd-private-39294ac7bf4b44198d87d45660dcbac2-phpsessionclean.service-4ShLZm
drwx------ 2 root root 4096 Dec 15 04:00 systemd-private-451ad0c3bfe6435891a80a6c714a222b-apache2.service-YQyZes
drwx------ 2 root root 4096 Dec 15 07:09 systemd-private-451ad0c3bfe6435891a80a6c714a222b-phpsessionclean.service-5L25TU
drwx------ 3 root root 4096 Dec 15 03:53 systemd-private-68bc1493e8804c968af642a2319c4e79-apache2.service-RY1iLF

Apache failing to start after install

I have just starting using Linode with Centos 7. I have never created my own server to host a website so apologies in advance.
I have read every stackoverflow (and other sites) Q&A's for this problem and I can't seem to fix it.
I installed Apache2 and followed the tutorial on Linodes website. The server doesn't start and I get these following errors:
When I run - systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
Active: failed (Result: exit-code) since Sun 2015-11-08 16:18:47 GMT; 10s ago
Process: 15662 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 15661 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=0/SUCCESS)
Main PID: 15661 (code=exited, status=0/SUCCESS)
Nov 08 16:18:47 london systemd[1]: Starting The Apache HTTP Server...
Nov 08 16:18:47 london httpd[15661]: httpd (pid 15652) already running
Nov 08 16:18:47 london kill[15662]: kill: cannot find process ""
Nov 08 16:18:47 london systemd[1]: httpd.service: control process exited, code=exited status=1
Nov 08 16:18:47 london systemd[1]: Failed to start The Apache HTTP Server.
Nov 08 16:18:47 london systemd[1]: Unit httpd.service entered failed state.
When I run - journalctl -xn
Logs begin at Thu 2015-10-22 20:33:26 BST, end at Sun 2015-11-08 16:18:47 GMT.
Nov 08 16:10:01 london systemd[1]: Starting Session 2857 of user root.
Subject: Unit session-2857.scope has begun with start-up
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Unit session-2857.scope has begun starting up.
Nov 08 16:10:01 london systemd[1]: Started Session 2857 of user root.
Subject: Unit session-2857.scope has finished start-up
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Unit session-2857.scope has finished starting up.
The start-up result is done.
Nov 08 16:10:01 london CROND[15635]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Nov 08 16:15:02 london sshd[15647]: Received disconnect from 43.229.53.26: 11: [preauth]
Nov 08 16:18:47 london systemd[1]: Starting The Apache HTTP Server...
Subject: Unit httpd.service has begun with start-up
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Unit httpd.service has begun starting up.
Nov 08 16:18:47 london httpd[15661]: httpd (pid 15652) already running
Nov 08 16:18:47 london kill[15662]: kill: cannot find process ""
Nov 08 16:18:47 london systemd[1]: httpd.service: control process exited, code=exited status=1
Nov 08 16:18:47 london systemd[1]: Failed to start The Apache HTTP Server.
Subject: Unit httpd.service has failed
Defined-By: systemd
Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Unit httpd.service has failed.
I have absolutely no idea and can't see where I am going wrong. Can someone help at all??
Many thanks!

CentOS 7 apachectl httpd.service fails to start

I'm building https://github.com/devopsgroup-io/catapult-release-management and every once in a while trying to apachectl start an error of:
Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.
systemctl status httpd.service outputs:
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
Active: failed (Result: exit-code) since Wed 2015-07-15 19:25:23 EDT; 4s ago
Process: 3247 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 3246 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 3246 (code=exited, status=1/FAILURE)
Jul 15 19:25:23 devopsgroup.io-dev-redhat systemd[1]: Starting The Apache HTTP Server...
Jul 15 19:25:23 devopsgroup.io-dev-redhat systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jul 15 19:25:23 devopsgroup.io-dev-redhat kill[3247]: kill: cannot find process ""
Jul 15 19:25:23 devopsgroup.io-dev-redhat systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 15 19:25:23 devopsgroup.io-dev-redhat systemd[1]: Failed to start The Apache HTTP Server.
Jul 15 19:25:23 devopsgroup.io-dev-redhat systemd[1]: Unit httpd.service entered failed state.
and journalctl -xn outputs:
-- Logs begin at Wed 2015-07-15 19:23:53 EDT, end at Wed 2015-07-15 19:25:23 EDT. --
Jul 15 19:25:11 devopsgroup.io-dev-redhat sshd[3196]: pam_unix(sshd:session): session opened for user vagrant by (uid=0)
Jul 15 19:25:17 devopsgroup.io-dev-redhat sudo[3221]: vagrant : TTY=pts/0 ; PWD=/home/vagrant ; USER=root ; COMMAND=/bin/su -l
Jul 15 19:25:17 devopsgroup.io-dev-redhat su[3222]: (to root) vagrant on pts/0
Jul 15 19:25:17 devopsgroup.io-dev-redhat su[3222]: pam_unix(su-l:session): session opened for user root by vagrant(uid=0)
Jul 15 19:25:23 devopsgroup.io-dev-redhat systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Jul 15 19:25:23 devopsgroup.io-dev-redhat systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jul 15 19:25:23 devopsgroup.io-dev-redhat kill[3247]: kill: cannot find process ""
Jul 15 19:25:23 devopsgroup.io-dev-redhat systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 15 19:25:23 devopsgroup.io-dev-redhat systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Jul 15 19:25:23 devopsgroup.io-dev-redhat systemd[1]: Unit httpd.service entered failed state.
Any ideas?
This was due to /etc/httpd/conf/httpd.conf being appended with more than 20 duplicate lines of IncludeOptional sites-enabled/*.conf
This is a bug in apachectl configtest as it reports correct configuration and does not provide a traceable error.