How To Move Apache’s Htdocs to Home Directory

For me, as developer, working with apache on home directory is the preferred way than working on default installation directory. To move your htdocs to home dir, you can follow this simple step.

  1. Create directory on your home dir, for the sake of this tutorial, let’s call it wwwroot.
  2. Change htdocs location at /etc/apache2/sites-enabled/000-default to your ~/wwwroot by editing every occurence of /var/www into /home/{username}/wwwroot. Replace {username} with your own username.
  3. Change apache’s running user to your username by editing APACHE_RUN_USER value to your username at /etc/apache2/envvars
  4. restart your apache server by executing sudo /etc/init.d/apache2 restart.

  5. You should now have successfully moved your htdocs into your home directory.

    Author: Arief Bayu Purwanto

    Hello, my name is Arief Bayu Purwanto, a 24 years old father of a beautiful daughter. Interested in online programming, linux, games, and reading. Currently working on kapanlagi.com as junior developer. I live in a relatively quite and cool place called Malang. I'm available for some freelance stuff as well as some consulting job. You can see my portofolio for some previous task I've finished and some other information related to my capability. Btw, I'm plurking here.

  • Thanks for sharing information. Is it possible to configure xampp to serve up a file outside of the htdocs directory?

  • This is very useful. For sure it is on my delicious and diigo bookmarks. Thanks.