0

If apache fails to restart, will it keep running but not shut down the previous instance of it? So if I'm working on the server and I restart apache and it fails, will that keep my site running on it's previous configuration?

1
  • Please post the exact error message you are getting.
    – Powertieke
    Jul 9, 2010 at 14:37

4 Answers 4

0

If your configuration is broken, even a configuration reload (via a SIGHUP) will cause Apache to exit.

You can use apachectl to do a simple configuration test. Be careful though, as it is a good check for syntax errors it will not catch everything. The full command is:

apachectl configtest

Also, many distributions include a wrapper for configtest in the init script.

1

If you tell apache to restart, it will shut down completely before attempting to restart, leaving you out in the cold if you have an error in your config syntax.

If you tell apache to restart gracefully, then, in addition to the niceties of it not killing processes underneath your users, apache will first check your configuration files for syntax errors. If it finds any, it will not restart.

I almost always use graceful when I'm making config changes; there are a few options (ServerLimit, for example) that need full restarts, but graceful should be your default command.

1
  • From the exact documentation you reference: If your configuration file has errors in it when you issue a restart then your parent will not restart, it will exit with an error.
    – Warner
    Jul 9, 2010 at 19:55
0

if you restart the service (because you changed the config file, maintenance, etc.), it actually stops and try to start it again, if it fails so the service itself will be not available.

as Warner says you need to check your config file and test it to make it sure it does not contains errors, so your service will be available again (successful start / restart)

but as long as you don't fix the problem in the config file, no instances will be available (no www service)

0

One thing to we wary of is that all the log files exist and can be written to. Configtest doesn't catch problems with creating or writing to log files, so that can prevent your server restarting correctly, and graceful restarts don't seem to prevent that.

2
  • What permissions to log files need to have? Wouldn't it just be root who's writing to them...
    – Ben
    Sep 24, 2010 at 15:07
  • Yes, normally root would be writing them. But if the directory you specify for the log files to go into doesn't exist, and root can't create it because it's in a path owned by some other user you're hosed. The safest way is to create an empty log file and then chown it to root.
    – Peter Bagnall
    Oct 16, 2010 at 16:26

You must log in to answer this question.

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