LAMP is an archetypal model of web service solution stacks, named as an acronym of the names of its original four open-source components: the Linux operating system, the Apache HTTP Server, the MySQL relational database management system (RDBMS), and the PHP programming language.
Installing lamp server will create a root directory of an Apache server on /var/www/html. I like to change the root directory because of some permission problem on /var/www/html and also to make easy of managing my projects on my custom directory. Here are the steps to changed root directory on LAMP server.
- We need to change the path on the file /etc/apache2/sites-available/000-default.conf, Use the following command to edit the file.
sudo nano /etc/apache2/sites-available/000-default.conf
And then change the path on the following line to whatever we want
- Also, We need to change on other files /etc/apache2/apache2.conf, By Using the following command.
sudo nano /etc/apache2/apache2.conf
Here, We need to change /var/www/html to your preferred directory from the following and then save it.
Options Indexes FollowSymLinks
Require all granted
- After we changed the path on two files we need to restart the Apache server using the following command
sudo service apache2 restart