Shared server guidance · Question & answer

How do I diagnose a 403 Forbidden response on a server?

A 403 response means a component refused the request, but the reason may be intentional authentication policy, filesystem access, a missing allowed index or a security rule. Find the component that produced the response before changing permissions. Making a whole website writable does not diagnose a forbidden request.

BeginnerLinux Nginx or Apache web servers
Go to the answer

Before you start

  • The exact failing URL and request time.
  • Read access to the configured site error log.

Instructions

1. Capture the actual response

Use a request that is safe to repeat. If the page needs authentication, test through the approved client session rather than pasting session cookies into commands or public tickets.

Remote Linux shell
curl --silent --show-error --output /dev/null --write-out '%{http_code}
' --max-time 15 https://app.example.com/

Makes a bounded GET and prints the HTTP status without displaying the body.

2. Read the relevant error log

Use the configured virtual-host log. The example is a common Nginx path; Apache and control panels commonly use different per-site paths.

Remote Linux shell
sudo tail -n 60 /var/log/nginx/error.log

Displays a bounded recent log extract for correlation with the failing request.

3. Inspect the exact path and access policy

Check directory traversal and file readability, then review the matched web-server location or directory policy. If SELinux is enforcing, inspect the specific denial separately.

Remote Linux shell
ls -ld /var /var/www /var/www/app /var/www/app/public
ls -l /var/www/app/public/index.html

Inspects the example path; substitute the actual configured document root and index file.

Check the result

  • A specific logged denial is explained and any approved targeted correction makes the intended request succeed.
  • Protected files and deliberately restricted routes remain restricted.

Troubleshooting

The error mentions directory index forbidden
Confirm the intended index file and route configuration. Do not enable public directory listing merely to remove the status code.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.