Cannot Start Apache
I updated my whm, and apache is cannot starting
when I have to run through the SSH Terminal it gives me this error:
# service httpd restart
Parando o httpd: [FAIL]
Iniciando o httpd: AH00526: Syntax error on line 12 of /etc/apache2/conf.d/modsec2.conf:
ModSecurity: Failed to open the audit log file: /etc/apache2/logs/modsec_audit.log
[FAIL]
when I try directly through WHM, in the services it gives me this error:
Restarting Apache Web Server
Unable to open log file "/etc/apache2/logs/error_log" - No such file or directory at /usr/local/cpanel/Cpanel/HttpUtils/ApRestart.pm line 294.
-
it tells you what is wrong in both errors Syntax error on line 12 of /etc/apache2/conf.d/modsec2.conf Failed to open the audit log file: /etc/apache2/logs/modsec_audit.log & Unable to open log file "/etc/apache2/logs/error_log" - No such file or directory your log files are missing 0 -
Hi Dalem, thanks for feedback, How do I recover the log file? 0 -
Hello @vallordigital01, Did you manually remove the log files from the /etc/apache2/logs/ or /usr/local/apache/logs (the latter is a symlink) directories? If so, you can manually recreate them using the "touch" command. EX: touch /etc/apache2/logs/error_log touch /etc/apache2/logs/modsec_audit.log
Then, ensure permissions are properly configured on these files. EX:chmod 0644 /etc/apache2/logs/error_log chmod 0600 /etc/apache2/logs/modsec_audit.log
The modsec log files are assigned 0600 permissions by default, whereas the error_log is assigned 0644 permissions by default. Thank you.0 -
Hello Michael, thanks for feedback But not working i set the comand: touch /etc/apache2/logs/error_log touch /etc/apache2/logs/modsec_audit.log and looking back a mensagem give back [root@s198-12-148-24 ~]# touch /etc/apache2/logs/error_log touch: touch it was not possible "/etc/apache2/logs/error_log": File or directory not found [root@s198-12-148-24 ~]# touch /etc/apache2/logs/modsec_audit.log touch: touch it was not possible "/etc/apache2/logs/modsec_audit.log": File or directory not found [root@s198-12-148-24 ~]# 0 -
Hello @vallordigital01, Did you manually remove the log files from the /etc/apache2/logs/ or /usr/local/apache/logs (the latter is a symlink) directories? If so, you can manually recreate them using the "touch" command. EX:
touch /etc/apache2/logs/error_log touch /etc/apache2/logs/modsec_audit.log
Then, ensure permissions are properly configured on these files. EX:chmod 0644 /etc/apache2/logs/error_log chmod 0600 /etc/apache2/logs/modsec_audit.log
The modsec log files are assigned 0600 permissions by default, whereas the error_log is assigned 0644 permissions by default. Thank you.
Hello Michael, thanks for feedback But not working i set the comand: touch /etc/apache2/logs/error_log touch /etc/apache2/logs/modsec_audit.log and looking back a mensagem give back [root@s198-12-148-24 ~]# touch /etc/apache2/logs/error_log touch: touch it was not possible "/etc/apache2/logs/error_log": File or directory not found [root@s198-12-148-24 ~]# touch /etc/apache2/logs/modsec_audit.log touch: touch it was not possible "/etc/apache2/logs/modsec_audit.log": File or directory not found0 -
Hello @vallordigital01, It's possible the symbolic links are missing. Can you run the following commands and post the output? cd /etc/apache2/ ls -al
Thank you.0 -
Hello @vallordigital01, It's possible the symbolic links are missing. Can you run the following commands and post the output?
cd /etc/apache2/ ls -al
Thank you.
Follow the output # cd /etc/apache2/ # ls -al total 36 drwxr-xr-x 7 root root 4096 Jan 8 16:46 . drwxr-xr-x 91 root root 12288 Jan 8 17:25 .. drwxr-xr-x 2 root root 4096 Dez 3 14:18 bin drwxr-xr-x 2 root root 4096 Jan 8 17:18 conf drwxr-xr-x 7 root root 4096 Dez 10 20:07 conf.d drwxr-xr-x 2 root root 4096 Jan 8 16:02 conf.modules.d drwxr-xr-x 2 root root 4096 Jan 8 16:46 log lrwxrwxrwx 1 root root 21 Dez 6 04:13 logs -> ../../var/log/apache2 lrwxrwxrwx 1 root root 31 Dez 6 04:13 modules -> ../../usr/lib64/apache2/modules lrwxrwxrwx 1 root root 21 Dez 6 04:13 run -> ../../var/run/apache2 Thanks again :)0 -
Hello @vallordigital01, It looks like the required files and links in that directory exist. Can you check to confirm if the /var/log/apache2 directory exists as well? EX: stat /var/log/apache2
Thank you.0 -
Hello @vallordigital01, It looks like the required files and links in that directory exist. Can you check to confirm if the /var/log/apache2 directory exists as well? EX:
stat /var/log/apache2
Thank you.
# stat /var/log/apache2 stat: impossible to obtain "/var/log/apache2": File or directory not found # :(0 -
# stat /var/log/apache2 stat: impossible to obtain "/var/log/apache2": File or directory not found #
You can create that directory using the following commands (assuming /var/log itself exists):mkdir /var/log/apache2 chmod 0711 /var/log/apache2
From there, run the commands noted in my earlier response to create the individual log files. Thank you.0 -
You can create that directory using the following commands (assuming /var/log itself exists):
mkdir /var/log/apache2 chmod 0711 /var/log/apache2
From there, run the commands noted in my earlier response to create the individual log files. Thank you.
Is a crazy [root@s198-12-148-24 apache2]# mkdir /var/log/apache2 mkdir: impossible to obtain "/var/log/apache2": the file exists [root@s198-12-148-24 apache2]# chmod 0711 /var/log/apache2 this code is working, but in reset the Apache i recived the bellow mesage: Unable to open log file "/etc/apache2/logs/error_log" - Not a directory at /usr/local/cpanel/Cpanel/HttpUtils/ApRestart.pm line 294.0 -
Hello @vallordigital01, Could you open a , is a godaddy Licence, i cannot open a ticket in sistem because I do not have login how can we solve?:
0 -
@cPanelMichael, Thanks for support, follow a ticket number 11150897 0 -
Hello @vallordigital01, Thanks for opening the ticket. I've been following it, and it looks like the issue is now solved after correcting the symbolic link for the /etc/apache2/logs path so that it points to the /var/log/apache2/ directory instead of pointing to /var/log/apache2 as a file. Let us know if you have any additional questions. Thanks! 0 -
I have similar problem here. Can you help me give the detail instruction how to correcting the symbolic link? 0 -
@alsorory In the ticket, it looks like the log files symlink was to a normal file and not a directory, so Apache could not start. I will show the commands used below. I cannot guarantee the following commands will work for you; I would suggest conferring with a systems administrator if you are unsure. cd /var/log cp -v apache2{,.bak} /bin/rm apache2 mkdir apache20
Please sign in to leave a comment.
Comments
17 comments