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.
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 :
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 :
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 the browser.
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.