After deploying the nginx server, enter the IP address and port number and return 403 Forbidden
Check the log error.log and find that the error message is:
directory index of “xxx” is forbidden
Where XXX is the root directory specified in/etc/nginx/nginx.conf.
Root cause of error: when accessing directly using IP address and port number, you need to specify index. If it is not specified, this error occurs.
At this time, you can add configurations in nginx/nginx.conf:
autoindex on# Automatic indexing
In this way, when accessed again, all resource indexes will be listed.
[note] after modifying nginx.conf, remember to restart the service to take effect.