AdminsForum

CloudPanel Sites & Nginx Guides

Guide CloudPanel Site Shows 403 Forbidden or 404 Not Found: How to Fix It

Started by JAY 0 replies 104 views
1JAY
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
#1
CloudPanel site shows 403 Forbidden or 404 Not Found: how to fix it

Your site was created, the domain points to the server, but the browser shows 403 Forbidden or 404 Not Found. These are Nginx answering, which is good news: the server works, it just can't find or isn't allowed to show the right file. Here's how to find out why.

Getting 403 in CloudPanel's own File Manager instead? That's a different problem: see CloudPanel File Manager 403 Forbidden. Seeing 502 or 504? See Fix 502 Bad Gateway in CloudPanel.

Step 1: Read the error log
The log usually names the exact problem. As root:
Code:
tail -n 30 /home/siteuser/logs/nginx/error.log
More on logs in CloudPanel logs: find and troubleshoot website errors.

403 Forbidden: the usual causes
1. No index file. The log says
Code:
directory index of "/home/.../htdocs/example.com/" is forbidden
. Nginx found the folder, but no
Code:
index.php
or
Code:
index.html
in it, and directory listing is off (as it should be). Upload your files, or check you didn't upload them into an extra sub-folder (a very common mistake when extracting a zip):
Code:
ls -la /home/siteuser/htdocs/example.com/

2. Wrong Root Directory. Many apps keep their public files in a sub-folder: Laravel uses
Code:
public
, Symfony uses
Code:
public
, some others use
Code:
web
or
Code:
pub
. In CloudPanel, open the site, go to Settings and set the Root Directory to that folder (for example
Code:
example.com/public
).

3. File ownership or permissions. Files uploaded as root, or extracted with odd permissions, can't be read by the site user. The log says
Code:
Permission denied
. Give the files back to the site user (as root), then let CloudPanel reset permissions to its own defaults (as the site user):
Code:
chown -R siteuser:siteuser /home/siteuser/htdocs/example.com su - siteuser cd ~/htdocs/example.com clpctl system:permissions:reset --directories=770 --files=660 --path=.
Code:
clpctl system:permissions:reset
is CloudPanel's built-in command for this; 770/660 are the values from CloudPanel's documentation.

4. You blocked yourself. The site's Security tab can block IPs and bots and add Basic Auth. Check you didn't add your own IP or a whole range. See CloudPanel site security.

404 Not Found: the usual causes
1. Only the home page works, every other page 404s. Classic for WordPress, Laravel and other apps with "pretty" URLs. On Apache those rules live in
Code:
.htaccess
, but Nginx ignores .htaccess files completely. The rules must be in the site's vhost. The fix is usually to use the right vhost template for your app: when you create a PHP site, CloudPanel lets you pick an application (WordPress, Laravel and many more) and sets up the right rules. For an existing site, compare the site's Vhost tab with a fresh site of the right type and look for the
Code:
try_files
line, for example:
Code:
location / { try_files $uri $uri/ /index.php?$args; }
Edit the vhost carefully; a typo can take the site down. Save a copy of the old version first.

2. Files in the wrong place. Same as the 403 case: check
Code:
ls
output and the Root Directory.

3. Upper and lower case. Linux file names are case-sensitive:
Code:
Logo.png
and
Code:
logo.png
are different files. Sites moved from Windows hosting often break here.

4. The domain shows a different site. If you see another site's 404, the request isn't reaching the vhost you think. Check the domain spelling and the
Code:
www
variant in the site's settings and vhost (
Code:
server_name
line), and that DNS points to this server:
Code:
dig +short A example.com
.

After every change
Clear your browser cache or test in a private window, and if the site uses Varnish, purge the cache (site > Varnish Cache > Purge). Cached 404s are a common reason a fix "didn't work".

Still stuck? Post the error log lines (hide your domain if you prefer) and which app you run.

Sources: Nginx: try_files · CloudPanel documentation


More CloudPanel troubleshooting
Applies to CloudPanel v2 on Ubuntu and Debian, October 2026. In the commands, replace
Code:
example.com
with your domain and
Code:
siteuser
with your site's user name (shown on the site's Settings page).
Reply
Possibly Related Threads…matched by title
Replies:0Views:108
Replies:0Views:128
Replies:0Views:150
Replies:0Views:304

Users browsing this thread: 1 Guest(s)
Forum Jump: