Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I realize this is a silly question, but I have been looking up different documentation for how to start/stop apache and from which directory, and have not found the right answer. So I thought I'd ask here.

I am using Ubuntu by the way.

Thanks in advance, Alex

share|improve this question
up vote 7 down vote accepted

In typical operation (running as a service, not troubleshooting or debugging, etc), the "proper" way to do it is with the service command:

service apache2 start
service apache2 stop
service apache2 restart
service apache2 reload (when you want to reload the config)

The directory that this is run from is inconsequential. And for your information, the scripts that the service command uses are in /etc/init.d; Apache's resides at /etc/init.d/apache2. So /etc/init.d/apache2 start etc. will also get what you want; but Ubuntu 10.10 and newer will whine at you to use the service command instead.

share|improve this answer
I got a "apache: unrecognized service" error when I ran the "service apache2 stop" command. I do have it running because I can go to localhost and get things working there. Any idea why I got that error? – Genadinik Mar 30 '11 at 22:41
@Genadinik Make sure you're using "apache2" instead of just "apache" -- the error message you got would imply that the "2" was missing. If that still doesn't work, try /etc/init.d/apache2 stop? – Shane Madden Mar 30 '11 at 22:44
It actually worked when I navigated to the scripts directory. Btw, any idea in which directory I can find the logs for Apache? Thanks! – Genadinik Mar 30 '11 at 22:46
@Genadinik: Logs are in /var/log/apache2 by default. – Stefan Lasiewski Mar 30 '11 at 22:49
this was a life saver I could not for the life of me figure out why service apache restart would not work! just need to add a '2' to it! – Tom Oct 10 '11 at 17:28

you could also use 'invoke-rc.d apache2 start' this should also allow you to run the apache2 init.d script

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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