14,974
edits
mNo edit summary |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 68: | Line 68: | ||
Root cause: the original syntax was written for another version of HTTP server. | Root cause: the original syntax was written for another version of HTTP server. | ||
=== Server side: lacks an index file (index.html) === | |||
==== Solution 1: Create Index Page (Recommended) ==== | |||
Create an index.html file in {{kbd | key=<nowiki>/path/to/website/</nowiki>}}: | |||
<pre> | |||
cat > /path/to/website/index.html << 'EOF' | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta charset="UTF-8"> | |||
<title>Website Title</title> | |||
</head> | |||
<body> | |||
<h1>Welcome</h1> | |||
</body> | |||
</html> | |||
EOF | |||
chmod 644 /path/to/website/index.html | |||
</pre> | |||
==== Solution 2: Enable Directory Listing ==== | |||
If the configuration file has been updated with {{kbd | key=<nowiki>autoindex on;</nowiki>}}, execute: | |||
<pre> | |||
# Verify configuration | |||
sudo nginx -t | |||
# Reload Nginx | |||
sudo systemctl reload nginx | |||
</pre> | |||
==== Verification Checklist ==== | |||
<pre> | |||
# 1. Verify directory permissions | |||
ls -ld /path/to | |||
ls -ld /path/to/website | |||
# 2. Ensure directories have rx (read+execute) permissions for others | |||
# Expected: drwxr-xr-x or more permissive | |||
# 3. Verify Nginx configuration | |||
sudo nginx -t | |||
# 4. Check Nginx error log | |||
sudo tail -f /var/log/nginx/error.log | |||
</pre> | |||
== More detail on HTTP server log == | == More detail on HTTP server log == | ||
| Line 76: | Line 129: | ||
* [https://www.hostinger.com/tutorials/what-is-403-forbidden-error-and-how-to-fix-it What Is the 403 Forbidden Error and How to Fix It (8 Methods Explained)] | * [https://www.hostinger.com/tutorials/what-is-403-forbidden-error-and-how-to-fix-it What Is the 403 Forbidden Error and How to Fix It (8 Methods Explained)] | ||
* [https://meshnetics.com/403-forbidden-error-in-wordpress-how-to-fix-it/ 403 Forbidden Error In WordPress - How To Fix it - Meshnetics] | * [https://meshnetics.com/403-forbidden-error-in-wordpress-how-to-fix-it/ 403 Forbidden Error In WordPress - How To Fix it - Meshnetics] | ||
* [https://developers.cloudflare.com/support/troubleshooting/http-status-codes/4xx-client-error/error-403/ Error 403 · Cloudflare Support docs] | |||
[[Category: Programming]] [[Category: Revised with LLMs]] | [[Category: Web server]] [[Category: Programming]] [[Category: Revised with LLMs]] | ||