A 403 Forbidden error means the server understood the request but refuses to fulfil it: access to the page or file is not allowed. Unlike 5xx errors, the server is working here — it has simply decided this resource must not be shown. Here is why that happens and how to find the cause on your own site.
How 403 Differs from 401 and 404
| Code | What it means | What usually helps |
|---|---|---|
| 401 Unauthorized | Authentication is required: login, password or token | Sign in or send valid credentials |
| 403 Forbidden | Access is denied, even if you are authenticated | Fix permissions, server rules or security settings |
| 404 Not Found | Nothing exists at this address | Check the URL, links and redirects |
If your site returns 5xx errors instead, see our guides to the 502 Bad Gateway error and to errors 504 and 524.
What to Do as a Visitor
- Reload the page and check the address: a 403 is sometimes returned when you open a folder instead of a page.
- Clear the site's cookies and cache or open it in a private window.
- Turn off your VPN or proxy: some sites block IPs of whole networks or countries.
- If the error stays, contact the site owner — the problem is almost always on their side.
Common Causes on the Site's Side
1. Wrong File and Folder Permissions
The web server runs as a separate user (www-data on Ubuntu and Debian). If it cannot read a file or enter a folder, visitors get a 403. Typical permissions are 755 for folders and 644 for files, owned by the web server user:
sudo chown -R www-data:www-data /var/www/example.com
sudo find /var/www/example.com -type d -exec chmod 755 {} \;
sudo find /var/www/example.com -type f -exec chmod 644 {} \;
Do not set 777 "just to make it work": it makes files writable by everyone and opens a security hole.
2. Missing Index File
If a folder has no index.php or index.html and directory listing is disabled (as it should be), the server returns 403. Check that the file exists and that your Nginx config lists it:
server {
root /var/www/example.com;
index index.php index.html;
# ...
}
3. Deny Rules in Nginx or .htaccess
deny all rules are useful for service files, but an overly broad pattern can block normal pages too. In Nginx, review your location blocks:
location ~ /\. {
deny all;
}
# check that no broad rule like this blocks your real pages:
# location / { deny all; }
In Apache, check .htaccess and the site config. After moving to Apache 2.4, old 2.2 syntax often causes 403:
# Apache 2.4
Require all granted
# old Apache 2.2 syntax that may cause 403 on 2.4:
# Order deny,allow
# Deny from all
4. Security Plugins and WordPress
Security plugins (firewalls, login limiters, country blocking) can add their own rules to .htaccess or block IPs. Temporarily rename the plugin folder over SSH or SFTP and see whether the error disappears. If it does, adjust the plugin rules rather than removing protection altogether.
5. Cloudflare, WAF and IP Blocking
The 403 may come not from your server but from Cloudflare or another WAF — for example, because of country rules, Bot Fight Mode or a suspicious IP. The sign is an error page with the Cloudflare logo and a Ray ID. Check Security → Events to see which rule fired.
6. SELinux and Non-Standard Paths
On CentOS, AlmaLinux and Rocky Linux, SELinux can prevent the web server from reading files outside standard folders even with correct permissions. Check the file context (ls -Z) and the audit log.
How to Find the Exact Cause in the Logs
The web server error log almost always names the cause directly: permission denied, directory index of ... is forbidden or access forbidden by rule.
sudo tail -n 50 /var/log/nginx/error.log
sudo tail -n 50 /var/log/apache2/error.log
After any change, test the config and reload the web server:
sudo nginx -t && sudo systemctl reload nginx
# or for Apache
sudo apachectl configtest && sudo systemctl reload apache2
Quick Checklist
- Is the error returned by your server or by Cloudflare/WAF?
- What does error.log say at the moment of the request?
- Are permissions 755/644 and is the owner the web server user?
- Does the index file exist and is it listed in the config?
- Are there broad deny rules in Nginx or .htaccess?
- Is a security plugin or SELinux blocking the request?
On a PSB Hosting VPS you have root access to every log and config, so a 403 can usually be found and fixed in minutes. If your site grows and the load increases, have a look at Hi-CPU VPS. More error breakdowns and guides are in the PSB Hosting blog.









