-1

I'm trying to create a virtual host that have path to user directory like this /home/user1/dev

My *.conf file is it /etc/apache2/sites-available/mysite.conf, like this

<VirtualHost *:80>
    ServerName mysite
    DocumentRoot /home/user1/dev
    ServerAlias mysite
    <Directory /home/user1/dev>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
   </Directory>
 </VirtualHost>

I add group www-data to directory /home/user1/dev and user1 belong to group www-data too.

Also I add to /etc/hosts

127.0.0.1 mysite mysite

But I get 403 Forbidden

You don't have permission to access / on this server.

I'm using

Server version: Apache/2.4.10 (Debian)
Debian GNU/Linux 8.2 (jessie)

ls -la /home/user1/dev

drwxrws---  5 user1 www-data 4096 dic  2 01:53 .
drwxr-x--- 99 user1 user1   4096 dic  2 03:49 ..
-rwxrwx---  1 user1 www-data   54 feb 27  2014 index.html
-rwxrwx---  1 user1 www-data   23 dic  2 01:53 index.php

Any help or other suggestion to point path to user directory?

gvd
  • 109
  • 4
  • Is the symlink in `/etc/apache2/sites-enabled`? What do the error logs say? – womble Dec 03 '15 at 02:48
  • Yes symlink is in /etc/apache2/sites-enabled. error log: AH00035: access to / denied (filesystem path '/home/omixam/localhost_omixam') because search permissions are missing on a component of the path – gvd Dec 03 '15 at 03:11
  • Start with the proper directives for Apache 2.4, see https://httpd.apache.org/docs/2.4/upgrading.html – Federico Sierra Dec 03 '15 at 03:42
  • I did the change in my .conf file but I still having the same error. – gvd Dec 03 '15 at 04:46
  • And are the permissions on `/home/user1/` sufficiently open? – HBruijn Dec 03 '15 at 05:39
  • The permisions obtain with ls -la /home/user1/ are drwxr-x--- – gvd Dec 03 '15 at 06:52
  • 1
    From the link posted by Federico Sierra: "You should review the Authentication, Authorization and Access Control Howto, especially the section [Beyond just authorization](https://httpd.apache.org/docs/2.4/howto/auth.html#beyond) which explains the new mechanisms for controlling the order in which the authorization directives are applied." The config posted above doesn't look like you've made the necessary changes (hint: Allow & Order -> Require*) – zagrimsan Dec 03 '15 at 08:29

1 Answers1

2

search permissions are missing on a component of the path

There's your answer. Some component of /home/omixam/localhost_omixam is missing o+x (or g+x if the group is www-data). Fix that, problem solved.

womble
  • 95,029
  • 29
  • 173
  • 228
  • Thanks for your help. Was very helpful. I also add some details that work for me. – gvd Dec 05 '15 at 02:06