Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 installed apache2 on my local machine, and when typing which apache2 it returns:


And when trying setting path for apache2 by using the following command:

sudo apache2 -settingpath /usr/sbin/apache2

It failed! It failed because whenever I restart apache2 using apache2 restart, I always receive error message telling me that I used the wrong user id.

So could you help me set path for Apache http server on Ubuntu 12.04?

share|improve this question

The Default path for apache is /var/wwww.

You can change it by Configuring


file. You can find it in


share|improve this answer
Hi Ketan Patel. Thank you for your answer. However, I want to configure the path to start apache. That is to say, I can simply type: apache2 restart, instead of /etc/init.d/apache2 restart. – petwho Sep 27 '12 at 7:05

I think you are looking to use the -k restart thus

sudo apache2 -k restart

To which you will be prompted for your password with which you log in.

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.