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.

    Share