TransWikia.com

Apache service doesn't start after deleting log files

Server Fault Asked by Nikola Lukic on November 9, 2021

I deleted the whole log files directory.

 sudo apachectl start
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
[root@maximumroulette ~]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2020-07-21 15:58:15 UTC; 2s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 3703 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 3702 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 3702 (code=exited, status=1/FAILURE)

Jul 21 15:58:15 maximumroulette httpd[3702]: [Tue Jul 21 15:58:15.725253 2020] [so:warn] [pid 3702] AH01574: module proxy_http_module is already loaded, skipping
Jul 21 15:58:15 maximumroulette httpd[3702]: [Tue Jul 21 15:58:15.725424 2020] [so:warn] [pid 3702] AH01574: module proxy_wstunnel_module is already loaded, skipping
Jul 21 15:58:15 maximumroulette httpd[3702]: (13)Permission denied: AH00091: httpd: could not open error log file /var/log/httpd/error_log.
Jul 21 15:58:15 maximumroulette httpd[3702]: AH00015: Unable to open logs
Jul 21 15:58:15 maximumroulette systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jul 21 15:58:15 maximumroulette kill[3703]: kill: cannot find process ""
Jul 21 15:58:15 maximumroulette systemd[1]: httpd.service: control process exited, code=exited status=1
Jul 21 15:58:15 maximumroulette systemd[1]: Failed to start The Apache HTTP Server.
Jul 21 15:58:15 maximumroulette systemd[1]: Unit httpd.service entered failed state.
Jul 21 15:58:15 maximumroulette systemd[1]: httpd.service failed.

Updated:

Now in error_log I found info:

(13)Permission denied: AH00091: httpd: could not open error log file /etc/httpd/logs/ssl_error_log.

When i want to start mongod service i got same logs…

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)

I found answer here :
https://unix.stackexchange.com/questions/377903/can-not-restart-the-httpd-service/377932#377932

I saw your environment is development, not production.
So set the selinux permissive model can be help
Follow the steps:
# getenforce
# setenforce 0   // there will print `Permissive`
# systemctl start  httpd.service
Check it :

systemctl status  httpd.service

but anyway your answers helps me to move from dead line.

2 Answers

Your error is could not open error log file /etc/httpd/logs/ssl_error_log You say you deleted the whole log folder; the problem is that while Apache will happily create the log file at startup, it will not create the folder.

/etc/httpd/logs is meant to be a symlink to /var/log/httpd, so the question is "what did you delete?".

Execute ls -ld /var/log/httpd /etc/httpd/logs.

You probably only see one of the two, and an error saying that the other one does not exist.

To create /etc/httpd/logs execute ln -s /var/log/httpd /etc/httpd/logs

To create /var/log/httpd execute mkdir -p /var/log/httpd && chmod go= /etc/httpd/logs. This will create the folder and set minimum permissions on it.

I've set folder permissions to the minimum, apache will be running as root when opening the logs so it's not a problem. You may need or wish to relax the permissions later on.

Answered by Law29 on November 9, 2021

Recreate it by running as root:

touch /var/log/httpd/error_log

Then restart apache.

Answered by CD Brian on November 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP