Ali
Ali

Reputation: 643

Access denied on Apache subfolder

I have created an Apache2 server which is accessible from the Net. But when I added a subfolder which is: myserver/test
=> this address is not accessible (404 Not found error)

How can I fix this?

Upvotes: 2

Views: 2156

Answers (3)

44kksharma
44kksharma

Reputation: 2830

just check if you have read permission on the sub directory or folder with command ls -la you can give read access permission on the sub folder

chmod -R 775 /var/www/html/subfolder 
Or 
chmod -R 775 /var/www/subfolder 

as per your folder structure

Upvotes: 0

Ali
Ali

Reputation: 643

OK, i found the solution. Indeed, i wanted to add a virtual host, so i've modified the apache2.conf file. And in the bottom of this file, i've commented an important line which is : include available-sites

Right now every thing is ok

Upvotes: 0

umläute
umläute

Reputation: 31374

first of all, are you sure you created the new folder test in the correct place? on Debian, apache2 is configured by default to have a SiteRoot (the root of your static websites) to live in /var/www. obviously, only files/directories that are within this directory will be served by apache.

your webserver is running as a system user (on Debian this is www-data by default). as such, the webserver may only access files that this user may access. chances are, that you have created the new folder with permissions that prevent the webserver to access any files (or the folder itself). to fix it use something like:

  chgrp -R /var/www/test
  chmod -R g+rX /var/www/test

Upvotes: 1

Related Questions