From the documentation I have this:
AliasMatch "^/projects/(.+)" "/var/www/domain.name/$1/public"
It should match only URLs like ../projects/project1
, not ../projects/
by itself.
When I go to say, http://example.org/projects/project1/
it returns a 403 Forbidden
.The logs say because of:
No matching DirectoryIndex found, and server-generated directory index forbidden by Options directive
.
I've tried adding a DirectoryIndex
explicitly in the vhosts but to no avail. I opened up the directory (/var/www/domain.name/project1/public
) to be readable by everyone and now it just shows a directory listing of the folder I want. I can see that its going to the right folder and can see the index.html file but it just doesn't automatically get it like it should.
Summarized version of my VirtualHost file:
<VirtualHost *:443>
DocumentRoot /var/www/domain.name/www/public
ServerName www.domain.name
AliasMatch "^/projects/(.+)" "/var/www/domain.name/$1/public"
ErrorDocument 401 err.php
ErrorDocument 404 err.php
ErrorDocument 500 err.php
<Directory /var/www/domain.name>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
If I then set the permissions on the specific project folder to 755 I just get a directory listing. I've changed it back to 711.
All folders in /var/www/ are owned by username:www-data and have the permissions 711.
If I do a direct Alias to the folder i.e. Alias /projects/<actual-project-name> /var/www/domain.name/<project-name>/public
it works.