Checked
2026-11-14
/ 403 Forbidden

403 Forbidden: the server found the page and will not serve it

A 403 means the web server runs and decided not to serve the request. On a server you run, that decision comes from one of four places: file permissions, a folder with no index file, a rule in the config, or a security module. The error log says which.

Read the error log

tail -n 30 /var/log/nginx/error.log, or /var/log/apache2/error.log on Debian and Ubuntu and /var/log/httpd/error_log on the Red Hat family. Load the page and read the new line.

  • nginx: open() "/var/www/site/index.html" failed (13: Permission denied) means the nginx user cannot read the file or cannot enter a folder on the way to it.
  • nginx: directory index of "/var/www/site/" is forbidden means the folder has no index file and listing is off.
  • Apache: AH01630: client denied by server configuration means a Require rule turned the request away.
  • Apache: AH01276: Cannot serve directory, No matching DirectoryIndex is the missing index file.
  • No new line at all: the 403 comes from something in front of the web server, a CDN, a firewall or a security plugin.

Permissions

The web server's user, www-data on Debian and Ubuntu, nginx or apache on the Red Hat family, needs read on the file and execute on every folder above it. namei shows the whole path at once:

namei -l /var/www/site/index.html

755 for folders and 644 for files are the usual values. Change owner with chown and mode with chmod on the site's own folder only, never on / or /var. chmod -R 777 makes the 403 go away and lets every process on the server write into the site.

A missing index file

After a deploy or a move, index.html or index.php may simply not be where the config looks. For a PHP site on nginx, the index line has to name it: index index.php index.html;. Check that root in nginx, or DocumentRoot in Apache, points at the folder that holds it.

Deny rules and SELinux

In nginx, look for deny all; or an allow list in the site's server and location blocks. In Apache 2.4 the folder needs Require all granted; the old Order and Allow from all lines belong to Apache 2.2 and work only through a compatibility module. A .htaccess file in the folder can add a deny rule of its own.

On RHEL, Rocky, Alma and Fedora, SELinux blocks files without the right label even when the permissions look fine. ls -Z shows the label, and restorecon -Rv /var/www resets it to the default. Files moved in with mv keep their old label, which is the classic cause. A site outside /var/www first needs a rule of its own with semanage fcontext.

What not to do

  • Do not chmod 777 anything.
  • Do not switch SELinux off to fix one folder. Label the folder.
  • Do not delete a .htaccess file without reading it. It may hold rewrites the site needs.

When to stop and hand it over

Stop if the log says nothing and you cannot tell what sits in front of the server, or if the 403 appeared on its own with no change from you: unexplained rule changes are also a sign of a break-in. Our Server Rescue is one incident at a fixed $69, with a same-day start listed at $109, and nothing to pay if we cannot fix it.

/ Questions

Questions people ask

Is a 403 the same as a 401?
No. A 401 asks you to log in. A 403 says the server will not serve this, whoever you are.
Why do I get a 403 after moving the site?
Files copied with the wrong owner, a missing index file, or on the Red Hat family an SELinux label carried over by mv. The error log line says which.
Can a security plugin cause a 403?
Yes. WordPress security plugins and web application firewalls answer 403 to requests they think are attacks. If the web server's log is quiet, look there.
What does fixing a 403 cost?
With us, Server Rescue at $69 for the incident, or $109 for a same-day start. If we cannot fix it, you pay nothing.
/ Sources

Where each statement comes from

Checked against the sources on .

More server help