[SOLVED] Domain.name/dir 403 Forbidden

I have changed directory for web server files for all specific domains
to /home/user-data/www/domain.name
and copited my html web to sub folders
/home/user-data/www/domain.name/folder1 folder2 etc.
changed the owner
chown www-data:www-data /home/user-data/www/domain.name/*
but I am still getting when visiting
https://domain.name/folder1 403 Forbidden :frowning:

What am i doing wrong?


You need to make sure the correct permissions are on all sub-folders starting with the www one. Also all sub-folders need to have the x permission set, while the files don’t need that. To restore the permissions as they are after a brand new installation, run the following two commands:

chown -R www-data:root /home/user-data/www
chmod -R a-rwx,u=rwX,g=rX,o=rX /home/user-data/www

r stands for read, w stands for write, x stands for execute
The upper-case X makes it automatically apply the x permission to all folders, but not files. x is required on folders in order to be able to “see” into them. Just giving r is not enough here.

a-rwx removes all existing and possibly wrong permissions from the files and folders
u=rwX sets the permissions for the user (which we just set to www-data) to have all rights
g=rX sets the permissions for the group (which we just set to root) to allow reading
o=rX sets the permissions for other (everyone else) to allow reading

Still not working, I have named the index file “index.config.html” would that be the problem?
-rw-r–r-- 1 www-data root 1.4M Jun 18 22:04 index.config.html

Yes! The file has to be called index.html or index.php

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.