简体   繁体   中英

Apache can't access files in home folder

I am running Apache with PHP on an Ubuntu server. I have some user folders that I want Apache to serve up. Each one is a unique subdomain:

/home/alec/www
/home/bob/www
/home/carl/www

I already have the configuration files setup in the sites-available/ folder and enabled them. However, when I try to access the sites in my browser, I'm getting a 403 error in all of them. Apache is saying that it's unable to access the root directory.

All folders and files (including the /home folder) have www-data as the group, the user's name as the owner (except for home and www, which have root set as the owner) and 755 permissions.

Any idea what I'm doing wrong?

Try to add Apache authorization to access the locations. For Apache > 2.4 :

<Directory /path/to/public/website/> Require all granted ... </Directory>

Also, if you added configuration override through htaccess files with :

<Directory /path/to/public/website/> AllowOverride All ... </Directory>

you may check the htaccess file in the folder you try to access.

As a workaround , you could also make symbolic links from the default Apache folder to your site folder.

 sudo ln -s /var/www/htlm/mysite /path/to/mysite

You should add your current configuration and Apache version to the question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM