配置 apache 后无法访问虚拟主机目录

配置 apache 后无法访问虚拟主机目录

我的虚拟主机有这个配置文件:

<VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot /home/kleber/www/kleber
        ServerName klebermota.eti.br
        ServerAlias www.klebermota.eti.br
</VirtualHost>

在我的apache2.conf我有这个配置:

<Directory />
        Options FollowSymLinks
        AllowOverride none
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride none
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride none
        Require all granted
</Directory>

当我尝试访问域时,出现错误:(You don't have permission to access this resource. 对于虚拟主机的任何目录)

谁能看出这里出了什么问题?

更新

pwd
/home/kleber
ls -la
total 287612
drwxr-xr-x 8 kleber kleber      4096 Mar 13 18:08 .
drwxr-xr-x 3 root   root        4096 Mar 13 16:10 ..
-rw------- 1 kleber kleber       905 Mar 13 21:28 .bash_history
-rw-r--r-- 1 kleber kleber       220 Mar 13 16:10 .bash_logout
-rw-r--r-- 1 kleber kleber      3771 Mar 13 16:10 .bashrc
drwx------ 2 kleber kleber      4096 Mar 13 16:13 .cache
-rw-r--r-- 1 kleber kleber         0 Mar 13 16:10 .cloud-locale-test.skip
drwx------ 3 kleber kleber      4096 Mar 13 16:13 .gnupg
drwxrwxr-x 3 kleber kleber      4096 Mar 13 16:58 .local
-rw-r--r-- 1 kleber kleber       807 Mar 13 16:10 .profile
-rw-rw-r-- 1 kleber kleber 294462718 Mar 13 16:45 file.tar.gz
drwxrwxr-x 2 kleber kleber      4096 Mar 13 16:35 sql
drwxrwxr-x 2 kleber kleber      4096 Mar 13 16:31 webapp
drwxrwxr-x 8 kleber kleber      4096 Mar 13 16:56 www
cd www
pwd
/home/kleber/www
ls -la
total 32
drwxrwxr-x 8 kleber kleber   4096 Mar 13 16:56 .
drwxr-xr-x 8 kleber kleber   4096 Mar 13 18:08 ..
drwxrwxr-x 5 kleber www-data 4096 Mar 13 17:25 ciencia
drwxrwxr-x 5 kleber www-data 4096 Mar 13 17:26 dailymaker
drwxrwxr-x 5 kleber www-data 4096 Mar 13 17:26 dailymaker_br
drwxrwxr-x 5 kleber www-data 4096 Mar 13 17:25 kleber
drwxrwxr-x 5 kleber www-data 4096 Mar 13 17:25 robotica
drwxrwxr-x 5 kleber www-data 4096 Mar 13 17:26 vidacrista

更新2

ps aux | grep apache
root     27348  0.0  0.9 193912 19408 ?        Ss   22:56   0:00 /usr/sbin/apache2 -k start
kleber   27349  0.0  0.5 194440 11920 ?        S    22:56   0:00 /usr/sbin/apache2 -k start
kleber   27350  0.0  0.5 194440 12128 ?        S    22:56   0:00 /usr/sbin/apache2 -k start
kleber   27351  0.0  0.5 194440 11912 ?        S    22:56   0:00 /usr/sbin/apache2 -k start
kleber   27352  0.0  0.5 194448 12084 ?        S    22:56   0:00 /usr/sbin/apache2 -k start
kleber   27353  0.0  0.5 194440 12128 ?        S    22:56   0:00 /usr/sbin/apache2 -k start
kleber   27354  0.0  0.5 194448 11820 ?        S    22:56   0:00 /usr/sbin/apache2 -k start
kleber   27363  0.0  0.5 194440 11920 ?        S    23:01   0:00 /usr/sbin/apache2 -k start
kleber   27440  0.0  0.5 194440 11968 ?        S    23:11   0:00 /usr/sbin/apache2 -k start
kleber   27441  0.0  0.5 194440 11924 ?        S    23:11   0:00 /usr/sbin/apache2 -k start
kleber   27442  0.0  0.5 194440 11924 ?        S    23:11   0:00 /usr/sbin/apache2 -k start
root     27542  0.0  0.0   8152   856 pts/0    S+   23:40   0:00 grep --color=auto apache

 ls -la / | grep home
drwxr-xr-x   3 kleber www-data  4096 Mar 13 16:10 home
ls -la | grep kleber
drwxr-xr-x  3 kleber www-data 4096 Mar 13 16:10 .
drwxr-xr-x  8 kleber www-data 4096 Mar 16 23:40 kleber

答案1

如果

DocumentRoot /home/kleber/www/kleber

那么也许你应该添加

<Directory /home/kleber/www/kleber>
    Options Indexes FollowSymLinks
    AllowOverride none
    Require all granted
</Directory>

您的配置。

相关内容