Sometimes after you installed a fresh linux system such as CentOS and implemented the LAMP on it. Then you found when you were trying to access the local web server, the web browser display some error message like "You don't have permission to access / on this server". This really ruins the day.

All the reason of this happening because the system didn't assign the proper permission for the "DocumentRoot". By the default, DocumentRoot (/var/www) is owned by user "apache" and the group "apache", but somehow some times it belongs to user "root" and user "apache" don't have permission to read and execute it. This usually also happened after you relocated your DocumentRoot path into a new directory.

To fix the issue, you need to reassign the permission to the DocumentRoot. Run the terminal and move to DocumentRoot:

$ cd /var/www

Then we are going to change the owner of directory of html:

$ sudo chown -R apache html/

After we modified the ownership o

...

[ Read More ]