403 Forbidden — [nginx](/blog/nginx-config-generator/)
Nginx can’t read the files it’s trying to serve.
Fix 1: Check file permissions
ls -la /var/www/html/
chmod -R 755 /var/www/html/
Fix 2: Check Nginx user
# See which user Nginx runs as
grep user /etc/nginx/nginx.conf
# Usually: user www-data;
# Make sure that user can read the files
chown -R www-data:www-data /var/www/html/
Fix 3: SELinux (CentOS/RHEL)
# Check if SELinux is blocking
getenforce
# Fix
sudo chcon -R -t httpd_sys_content_t /var/www/html/
Fix 4: Missing index file
location / {
index index.html index.htm;
autoindex on; # Or add this to list directory contents
}