After deploying the Nginx server, enter the IP address and port number, and return 403 Forbiddent
.
Check the log error.log
and find that the error message is:
directory index of xxx
is forbidden
Among them, xxx
is the root directory specified in /etc/nginx/nginx.conf
.
Root cause of the error: When directly using the IP address and port number to access, you need to specify the index, if not specified, the error will occur.
At this time, you can add configuration in nginx/nginx.conf
:
autoindex on; # Automatic index
In this way, when you visit again, all resource indexes will be listed.