Vagrant上的Apache 2.4和Ubuntu 14.04错误:“您无权访问/在此服务器上。

我意识到在这里有很多类似的问题,但我一直在挣扎几个小时,一直无法find解决scheme。

当我尝试通过主机名shopwise.dev (设置到/etc/hosts中的Vagrant框的IP)访问我的Vagrant Ubuntu框时,出现以下错误页面:

 Forbidden You don't have permission to access / on this server. Apache/2.4.7 (Ubuntu) Server at shopwise.dev Port 80 

我创build了文件/etc/apache2/sites-available/shopwise.conf

 ServerName host.foxytronics.com NameVirtualHost *:80 <Directory /> Options FollowSymLinks AllowOverride All Require all granted </Directory> <Directory "/home/shopws/public_html"> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory> <VirtualHost *:80> ServerAdmin [email protected] ServerName www.shopwise.dev ServerAlias shopwise.dev DirectoryIndex index.php Options FollowSymLinks DocumentRoot "/home/shopws/public_html" # Logfiles ErrorLog /home/shopws/logs/apache/error.log CustomLog /home/shopws/logs/apache/access.log combined </VirtualHost> 

然后跑:

 sudo a2ensite shopwise.conf service apache2 reload 

我validation了path/home/shopws/public_html的目录权限是755 ,文件权限也是755 (尽pipe我认为它们应该是644 ?)。

我的configuration不正确?

更新:

在这里输入图像说明

在这里输入图像说明

在这里输入图像说明

在这里输入图像说明

像往常一样,我的问题完全是我的错,由于我的无知:-)

我需要使用Directory指令来授予用户访问我select放置我的网站的文件的目录的权限。这是我最后的工作configuration:

 <VirtualHost *:80> ServerAdmin [email protected] ServerName www.shopwise.dev ServerAlias shopwise.dev DocumentRoot /home/shopws/public_html # Logfiles ErrorLog /home/shopws/logs/apache/error.log CustomLog /home/shopws/logs/apache/access.log combined </VirtualHost> <Directory /home/shopws/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> 

我希望有一天能帮助别人!

通过index.something我的意思是index.html,index.php等这里是你的错误文件:ErrorLog /home/shopws/logs/apache/error.log

第1步tail -f /home/shopws/logs/apache/error.log

第二步在浏览器中点击Refresh或者F5,你会在这里看到一些东西,如果不是这样的话,可以使用:tail -f /home/shopws/logs/apache/access.log

你也应该看到这里的东西,并粘贴在这里的最后一行。