Debian's Apache2 error log

3

I'm new to Debian and new at it's Apache2 webserver. I made some configuration about virtual host and I restarted Apache2 via service apache2 reload. I got this back: [FAIL] Reloading web server config: apache2 failed!. Not surprised about that. Ok let's see the error log what's gone wrong, but there is nothing about the above fail in /var/log/apache2/error.log. Is there another place where Apache2 log that fail?

Francesco

Posted 2015-01-10T15:54:10.153

Reputation: 185

2Try running sudo apache2ctl configtest and see what comes out. – a CVn – 2015-01-10T16:05:56.183

Does your virtual host log errors to its own error log file? E.g, if you have an ErrorLog line in your VirtualHost section for that site that specifies error messages be put into a separate error log for that virtual host, you will need to check that error log file. – moonpoint – 2015-01-10T16:32:15.830

@moonpoint yes I have an ErrorLog line but no log file was produced by Apache2. – Francesco – 2015-01-10T16:34:14.113

@Francesco Does Apache have write access to the directory that you've specified for the ErrorLog? You can see the permissions on the directory using "ls -ld path_to_directory", substituting the path and directory name you listed for ErrorLog for "path_to_directory". Note: you can have multiple ErrorLog lines in an Apache conf file. There can be one outside the VirtualHost section and another within a <VirtualHost> container, which will be the one that applies, if it is present. – moonpoint – 2015-01-10T16:40:29.720

@moonpoint yes Apache does but error.log is empty. Maybe it's a too bad configuration error that is logged elsewhere, could it be? – Francesco – 2015-01-11T14:34:43.680

@Francesco, if there are other ErrorLog files listed in your Apache conf file, check them as well. You could also edit your posting to show the virtual host section you recently edited, which might reveal the cause of the problem. You could replace the domain name in that section with something like example.com, if you don't want to reveal that information to all. – moonpoint – 2015-01-11T18:11:25.560

@MichaelKjörling it looks like apache2ctl configtest is the only way to have feedback about my problem, a modules incompatibility. Post your comment as answer and I'll mark it as valid. Thanks. – Francesco – 2015-01-12T14:31:10.723

Answers

2

If you suspect problems with your Apache 2 configuration, the easiest (and safest!) way to check that is to issue the command sudo apache2ctl configtest.

If everything is correct, it will print Syntax OK (or something similar), but if there are errors, it will tell you exactly what those errors are. What it does not do is have Apache actually load the configuration into the running server instance, so you don't break anything. It also won't write anything to your web server's log files. If configtest comes back clean, the configuration should at least be mostly okay.

When you are satisfied that the configuration is likely correct, use apache2ctl graceful or apache2ctl restart to actually start using the new configuration.

I recommend checking out the man page for apache2ctl for some of the finer details on these. Particularly, the man page does state that configtest "does not catch all errors", but my experience is that it catches most that occur in real life when tweaking configuration.

a CVn

Posted 2015-01-10T15:54:10.153

Reputation: 26 553

0

Config most likey is broken, that or the package itself is broken

try sudo apt pruge apache2

then sudo apt install apache2

this removes the config and Apache

If this doesn't work check the ports and the /www/ files (.html and .php)

For me its usally a port error with my firewall (If forgot what came up in the logs, so it might not be)

Raccoondude

Posted 2015-01-10T15:54:10.153

Reputation: 1

pruge? – Scott – 2019-04-02T13:59:19.770

But also, what does “check the ports and the /www/ files (.html and .php)” mean? – Scott – 2019-04-02T13:59:22.053

@Scott purge sorry, it removes both a program and config files – Raccoondude – 2019-04-03T13:35:32.260

Check if your ports are open and are not being blocked by a firewall, check if your files are comapatable with Apache, (make sure you install PHP) – Raccoondude – 2019-04-03T13:36:19.737