content
background
Enter localhost in the server to appear
Forbidden,You don't have permission to access / on this server.
The above error also occurs when entering a domain name on an external server
text
Checked Google Baidu, according to the method they gave
Delete Deny from all in apache2.conf , or modify it to Require all granted , still no results
After thinking about it carefully, the reason for the 403 error is my simple understanding.
1. Either because there is no permission to access (this one can be excluded)
2. Either the server is busy (for now, this will not be the case)
3. Either there is a problem accessing the directory (probably this is the reason) (the reasons and characteristics of various status codes need to be learned later)
Starting from the third point, I suddenly thought
When installing apache, changed the default www directory
Could it be because of the changed directory relationship?
Checked the default directory in apache2.conf and changed it to /home/www/
It turned out that only the home folder was created in the root directory, but the www folder was not created in it
Solution:
Create a new www folder and create a new index.html
The problem is solved, the localhost is successfully accessed, and the domain name is successfully accessed.
Summarize
Problems will always appear, and sometimes carefully deduce the root cause of the problem. For example, the root cause of this problem is the generation of 403 errors.
Return to the essence of the problem, start from the root of the problem, maybe you can solve the problem