0

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.

3
  • 1
    What's stopping you from recreating it?
    – user143703
    Jul 21, 2020 at 16:07
  • I have a buckup but i always got : kernel: type=1400 audit(1595348124.787:27): avc: denied { open } for pid=4631 comm="httpd" path="/var/log/httpd/err" dev="vda1" ino=42020102 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:ob Jul 21, 2020 at 16:17
  • You added a completely unrelated second question to this post. This should instead be posted separately as a new question. Jul 21, 2020 at 16:59

2 Answers 2

2

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.

6
  • 2
    /etc/httpd/logs is meant to be a symlink to /var/log/httpd. Jul 21, 2020 at 17:01
  • @MichaelHampton Hmmm, true. Maybe the deleted folder was just the symlink. Editing...
    – Law29
    Jul 21, 2020 at 17:03
  • What I'm not sure about (because OP didn't say) is which one he actually deleted. Jul 21, 2020 at 17:03
  • this is folder => /var/log/httpd Symlink : /etc/httpd/logs , but still have same bug Jul 21, 2020 at 17:06
  • @NikolaLukic What was in the audit log? Jul 21, 2020 at 17:20
1

Recreate it by running as root:

touch /var/log/httpd/error_log

Then restart apache.

1
  • I still get ` Unregistered Authentication Agent for unix-process:5706:411270 (system bus name :1.109, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus` Jul 21, 2020 at 16:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .