config
Nginx permission denied serving static files
open\(\).*failed.*Permission denied|forbidden.*directory index
Fixes
- 1.Ensure nginx worker process user (typically www-data/nginx) can read the files: chmod -R o+r /path
- 2.Check all parent directories have execute permission: chmod o+x on each directory in the path
- 3.Verify SELinux context if on RHEL/CentOS: restorecon -Rv /path or set httpd_sys_content_t
nginxpermissionsstatic-files
Related Errors
config3 fixes
Nginx 502 Bad Gateway - upstream unavailable
502 Bad Gateway|upstream prematurely closed connection
- •Verify the upstream server is running and listening on the expected address/port
- •Increase proxy_read_timeout and proxy_connect_timeout for slow backends
config3 fixes
Nginx 504 Gateway Timeout
504 Gateway Time-?out|upstream timed out.*reading response
- •Increase proxy_read_timeout (default 60s): proxy_read_timeout 300s
- •Optimize the backend endpoint that's taking too long to respond
config3 fixes
Nginx redirect loop
rewrite or internal redirection cycle|return 301.*too many redirects
- •Check for conflicting rewrite rules that redirect back and forth (HTTP→HTTPS→HTTP)
- •Use 'return 301' instead of 'rewrite' for simple redirects to avoid rule interaction