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.
Similar Posts:
- [Solved] nginx Error: directory index of “/home/www/hexo/” is forbidden
- [Solved] Nginx Log Error: open() “/opt/Nginx/nginx/nginx.pid” failed (2: No such file or directory)
- How to Solve Nginx error: 403 Forbidden
- [Solved] Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid
- nginx: [error] open() “/usr/local/nginx/logs/nginx.pid“ failed (2: No such file or directory)
- CentOS starts nginx and prompts nginx: [emergency] still could not bind ()
- Nginx+PHP FastCGI sent in stderr: “Primary script unknown” while reading response head…
- Nginx Error: nginx: [error] CreateFile() “D:\nginx-1.20.1/logs/nginx.pid” failed (2: The system cannot find the file specified)
- [Solved] docker nginx localhost connection refused connect() failed (111: Connection refused)while connecting to upstream
- nginx Server Start Error: nginx: [emerg] open() “/var/run/nginx/nginx.pid” failed (Linux Restart)