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?

7
  • 2
    Try running sudo apache2ctl configtest and see what comes out.
    – user
    Commented Jan 10, 2015 at 16:05
  • 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
    Commented Jan 10, 2015 at 16:32
  • @moonpoint yes I have an ErrorLog line but no log file was produced by Apache2.
    – Francesco
    Commented Jan 10, 2015 at 16:34
  • @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
    Commented Jan 10, 2015 at 16:40
  • @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
    Commented Jan 11, 2015 at 14:34

2 Answers 2

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.

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)

4
  • pruge? Commented Apr 2, 2019 at 13:59
  • But also, what does “check the ports and the /www/ files (.html and .php)” mean? Commented Apr 2, 2019 at 13:59
  • @Scott purge sorry, it removes both a program and config files Commented Apr 3, 2019 at 13:35
  • 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) Commented Apr 3, 2019 at 13:36

You must log in to answer this question.

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