Trying to restart Apache, and can't tell if it's restarting -- are there logs for the restart, or if I input the commandline to restart should I expect a response (error msg, confirmation, status, etc.)

Never done it before and not sure what's going on.

This is exactly what I'm typing, no $/# before it...


sudo apache2ctl restart

-- or --

apache2ctl restart

CONTEXT: Commands executed from the root directory, meaning... "cd /"

RESULT: Nothing appears to happen.


Depending on how Apache and syslog are configured on your machine, it may vary, however with a stock Debian or Ubuntu Apache 2 installation, you'd find the logs in /var/log/apache2/error.log. If it's restarting you should clearly see it in the logs.

Additionally, checking the output of ps, particularly the start time, you should be able to tell if it has restarted.

One last thing, if you're ever trying to find out if a command you just ran succeeded or failed, try echo $?. It'll print the return code of the last command. 99% of the time 0 is what you're looking for there.


apache2ctl should return a non-zero status code on failure. You can be informed of a failure by issuing your start command like this:

apache2ctl start || echo 'apache2ctl failed'

You should see no output if apache2ctl thinks it succeeded.

If you prefer something more concrete (following the maxim of "trust, but verify"), you can check whether apache is actually up and listening for connections with netstat, e.g.

netstat -anp | egrep -i 'http|apache'

If you see lines resembling this, then you're golden:

tcp6   0   0  :::80   :::*  LISTEN  1506/apache2
tcp6   0   0  :::443  :::*  LISTEN  1506/apache2

Or, if you're not running IPv6, you'll see something more like this:

tcp   0   0*  LISTEN  2341/apache2
tcp   0   0*  LISTEN  2341/apache2

In either case, the key point is that apache2 is LISTENing for incoming connections on the well-known www ports (80, and optionally 443).


Mine creates several [notice] entries in the error.log when I apache2ctl restart, starting with "[notice] SIGHUP received. Attempting to restart" and ending with "Apache (list of various modules) configured -- resuming normal operations"


There are several places you can look if apache restart. First syslog in /var/log directory. Second apache logs in /var/log/apache2 directory

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.