If you are making changes to apache, you should check the syntax before reloading the configs. Here is how to apache2ctl:
apache2ctl -t
To test your syntax use apache2ctl -t
james@someserver:/var$ apache2ctl -t
/usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
[Fri Mar 06 11:18:33 2015] [warn] VirtualHost somesite:80 overlaps with VirtualHost somesite:80,
the first has precedence, perhaps you need a NameVirtualHost directive
[Fri Mar 06 11:18:33 2015] [warn] NameVirtualHost *:443 has no VirtualHosts
It should say “Syntax OK”, but it shows some errors in this example that we need to fix or else service restart apache2 might choke.
apache2ctl -S
To get more verbose/detailed output about your config files:
jfraze@someserver:/var$ apache2ctl -S
/usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
[Fri Mar 06 11:17:32 2015] [warn] VirtualHost somesite:80 overlaps with VirtualHost somesite:80,
the first has precedence, perhaps you need a NameVirtualHost directive
[Fri Mar 06 11:17:32 2015] [warn] NameVirtualHost *:443 has no VirtualHosts
VirtualHost configuration:
10.10.10.80:80 someserver.your.net (/etc/apache2/sites-enabled/ssl:3)
wildcard NameVirtualHosts and _default_ servers:
*:443 is a NameVirtualHost
default server someserver.your.net (/etc/apache2/sites-enabled/ssl:43)
port 443 namevhost someserver.your.net (/etc/apache2/sites-enabled/ssl:43)
port 443 namevhost someserver.your.net (/etc/apache2/sites-enabled/ssl.drew:32)
Syntax OK
This tells us which files we need to look in to find the error at least.
Grepping for Errors
If you happen to have a ton of sites and need to find something in particular, you can’t pipe apache2ctl, but you can redirect the output:
apache2ctl -S 2>&1 | grep something
Happy digging!