Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save viswanathan16/394954c925bdb13330f0c6172941c5d6 to your computer and use it in GitHub Desktop.

Select an option

Save viswanathan16/394954c925bdb13330f0c6172941c5d6 to your computer and use it in GitHub Desktop.
4 steps to change your apache default document root directory

Step - 1: Create a directory

$ mkdir /home/masud/www/

Step - 2: Open apache2 configuration file

$ sudo nano /etc/apache2/apache2.conf 
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

Change it to

<Directory /home/masud/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
        Allow from all
</Directory>

Step - 3: Open default virtual host configuration file from path

$ sudo nano /etc/apache2/sites-available/000-default.conf 
DocumentRoot /var/www/html

Change document root to

DocumentRoot /home/masud/www/

Step - 4: Finally restart apache

$ sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment