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'm trying to learn how to configure an Apache HTTP server (with which I have no experience) someone else has setup in a VM running Ubuntu 8.04.

I know the server is running, since I get "<html><body><h1>It works!</h1></body></html>" when I go to (where is the VM's IP number).

I found apache2.conf and httpd.conf (among other files) in /etc/apache2/. httpd.conf is empty.

I tried adding DocumentRoot "/home/username/temp" into /etc/apache2/httpd.conf and put some simple HTML in /home/username/temp/index.html. But when I reload there's no change.

Do I need to restart httpd to get it to accept the change to DocumentRoot?

Update: I changed "DocumentRoot /var/www/" in /etc/apache2/sites-available/default to "DocumentRoot /home/username/temp", but the next HTML wasn't served until I ran sudo service apache2 restart. Can I tell Apache to reload the config (instead of restarting)?

Update #2: Got this from Karol Piczak's comment on his answer: sudo /etc/init.d/apache2 reload

share|improve this question
up vote 16 down vote accepted

You should have a file: /etc/apache2/sites-available/default this is where you would modify the default website's document root.

You can also add more sites by putting config snippets in that folder and symlinking them to ../sites-enabled or using a2ensite to enable them.

share|improve this answer
after modify /etc/apache2/sites-available/default with Document root map to /home/davuz/Code/www. I miss this error :"Forbidden You don't have permission to access /index.php on this server." I have tried chmod 775 www or 777 but it still error 403. – Davuz Nov 22 '12 at 11:08
The file is now called 000-default.conf – www139 2 days ago

Do I need to restart httpd to get it to accept the change to DocumentRoot?

Yes, or more precisely said - at least reload the config.

And I see Zypher was first here while I was writing - you should see some individual config in /etc/apache2/sites-enabled/

share|improve this answer
How do I reload the config? – Daryl Spitzer Apr 26 '10 at 21:47
Try /etc/init.d/apache2 reload – Karol Piczak Apr 26 '10 at 21:55

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.