-->

Failed Apache2 start, no error log

2019-03-14 07:32发布

问题:

I would restart Apache2 but there comes an Error

$ sudo service apache2 start

Starting web server apache2

Action 'start' failed.
The Apache error log may have more information.

But all error logs in "/var/log/apache2/" are empty.

Edit: The Files are at "/var/log/apache2" and there are several entries from previous Problems but this Task doesn't create any new etry ...

Where is the Problem?


I've Solved the Problem!

It was a error in the SSL Certificate and the path to the "error.log" are changed in the vHost configuration.

If you don't need SSL (i don't because i'm running a local system) simply disable all vHost HTTPS/SSL entrys in the configuration by command line for line out.

回答1:

Thanks, Tim! Big stumper for me. A few other details others may find helpful:

(Apache2 on Ubuntu 12.04)

I have two sites running on the same server and had just updated the SSL cert for one of them. Upon restarting the server, I got that cryptic message and neither site worked (obviously). I too found the redirect for the log files in the config files. I tracked that down and found the issue (in the log file for the site I had just updated).

My config files are located in /etc/apache2/sites-available

vim or cat the file (cat {filename}) and look for the ErrorLog line. That tells you where to look on your server. cat that file and the error message I found was:

[error] Unable to configure RSA server private key
[error] SSL Library Error: 185073780 error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch
[warn] RSA server certificate CommonName (CN) `<snip>.com' does NOT match server name!?

I had copied one of my cert files to the wrong directory. I simply moved it to the correct directory and everything was fine on the next start. (tip: where those file should be is also in the config file ;)



回答2:

I also just ran in to a similar problem, that is service apache2 reload fails but prints no useful information. This is because the script in /etc/init.d/apache (on Debian, at least) eats the output of the apache2ctl configtest command it runs to sanitize the Apache config.

An easy solution to get a more meaningful explanation for the failure is to run apache2ctl configtest again yourself, which will print the (hopefully useful) error messages to the console.



回答3:

Syntax errors in the config file seem to cause problems. I found what the problem was by going to the directory and excuting this from the command line.

httpd -e info 

This gave me the error

Syntax error on line 156 of D:/.../Apache Software Foundation/Apache2.2/conf/httpd.conf:
Invalid command 'PHPIniDir', perhaps misspelled or defined by a module not included in the server configuration


回答4:

in the apache virtualhost you have to define the path to the error log file. when apache2 start for the first time it will create it automatically.

for example ErrorLog "/var/www/www.localhost.com/log-apache2/error.log" in the apache virtualhost..



回答5:

On XAMPP use

D:\xampp\apache\bin>httpd -t -D DUMP_VHOSTS

This will yield errors in your configuration of the virtual hosts



回答6:

I ran into this problem on the Raspberry Pi. After trying everything but a reinstall, on a whim, I deleted /var/run/apache2/apache2.pid. I restarted Apache and everything worked. Not sure how to explain that.



回答7:

I ran into this exact issue today. I had copied the entire /etc/httpd from RHEL 6 and put it onto a CentOS 6 system, and ensured all RPMs were installed.

Anytime apache would be started, it would silently fail. It took an strace to find the culprit: I was using CustomLog to call a program that was not installed on the target system. Once I installed the expected program, Apache HTTP Server started right up.



回答8:

Try to disable SElinux or configuration virtualhost for SElinux

to configuration with SElinux https://muchbits.com/apache-selinux-vhosts.html

to disable SElinux https://linuxize.com/post/how-to-disable-selinux-on-centos-7/