Skip to content

Errors / HTTP errors

403 Forbidden nginx

nginx found the path but is not allowed to serve it.

Everyone gets the 403 for that path.

Seeing it on someone else’s site?

  • The site's server is refusing this page; it is a configuration problem on their side.

Why it happens, if it is your site

  • directory index of "/var/www/…/" is forbidden: a folder with no index.html / index.php, and autoindex off.
  • open() "…" failed (13: Permission denied): the nginx user cannot read the file, or cannot traverse one of the parent folders.
  • A deny all; in a location block, or an allow list that does not include the visitor.
  • On RHEL-family systems, SELinux blocking nginx from files outside its expected folders.

How to fix it

  1. Read the error log line: it says which of these it is.
  2. Add the index file, or the right index directive, for that folder.
  3. Give the nginx user read on files and execute on every parent folder (namei -l /path/to/file shows where it breaks).
  4. With SELinux, set the right context (chcon -R -t httpd_sys_content_t) instead of disabling it.

Whose problem it is

Usually the server that answers the request.

Does your site have it?

Free, no account. We open your page and four more in a clean Chrome and list every error like this one, with the page and the click that caused it. How the free page check works.

Check only sites you run or have permission to check.

Often seen with

  • 403 ForbiddenThe server understood the request and refuses to let you see this.
  • 404 Not Found (nginx)nginx looked for the page on disk, where the configuration says, and it is not there.
  • 502 Bad Gateway (nginx)nginx is running, but the application it passes requests to did not answer properly.