Monday, March 1, 2021

Published March 01, 2021 by Anonymous with 0 comment

How to change Apache Document root directory on Ubuntu 18.04

To modify the root folder in Apache, you would need to make changes to two files basically. We will first start by modifying the file /etc/apache2/apache2.conf.

Run the command :
sudo vim /etc/apache2/apache2.conf

Or using your favorite editor.

Read: How to install Apache web server on Ubuntu

Now that the file is in edit mode, look up the command : DocumentRoot

This indicates the directory where all requests will be handled and documents read.

Go ahead and replace the line which starts with DocumentRoot with :

DocumentRoot [your_target_directory]

You would need to ensure that there is no permission issue so that Apache can access your folder in read/write modes.

Now do the same procedure above for the file :

/etc/apache2/sites-enabled/000-default

Finally, save the files and restart Apache using the command:

systemctl restart apache2

This is the directory from which Apache will read the contents that the visitor will access over browser.

Read: How to use systemd to troubleshoot Linux problems


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

Let's block ads! (Why?)

      edit

0 comments:

Post a Comment