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.
2Try running
sudo apache2ctl configtest
and see what comes out. – a CVn – 2015-01-10T16:05:56.183Does 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