我如何设置灯没有禁止消息时,查看我的网站



我用的是Linux Mint 16 +最新的LAMP + Laravel。

当我尝试通过"localhost"或"127.0.0.1"查看我的网站时,我得到了这个错误。

Forbidden
You don't have permission to access / on this server.
------------------------------------------------------
Apache/2.4.6 (Ubuntu) Server at 127.0.0.1 Port 80

我的设置如下:

在/etc/hostname

NameServer ynwlocalwebserver
在/etc/hosts

127.0.0.1       localhost
127.0.1.1       ynwlocalwebserver
# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

我只有一个名为"ynwlocalwebserver.conf"的站点启用,目前的内容是:

NameVirtualHost *:80
<VirtualHost *:80>
  ServerName ynwlocalwebserver
  DocumentRoot /home/ynwmint/ynw/public
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
  <Directory /home/ynwmint/ynw/public>
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
<VirtualHost *:80>
  ServerName localhost
  DocumentRoot /home/ynwmint/ynw/public
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
  <Directory /home/ynwmint/ynw/public>
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

"/home/ynwmint/ynw/public"中的文件夹ynw是Laravel项目。

我将公共文件夹的chmod设置为777(暂时),并将其保存在www-data:www-data

我做错了什么,或者我还需要检查什么?

谢谢。

Apache 2.4在配置方面有一些小的变化。

:

ServerName ynwlocalwebserver
DocumentRoot /home/ynwmint/ynw/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/ynwmint/ynw/public>
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

应该改成:

<VirtualHost *:80>
    ServerName ynwlocalwebserver
    DocumentRoot /home/ynwmint/ynw/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory /home/ynwmint/ynw/public>
        Options +Indexes +FollowSymlinks + MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

同样为了增加安全性,你可能想要这样的目录规则:

<Directory />
    Options FollowSymlinks
    AllowOverride None
</Directory>

来源:http://httpd.apache.org/docs/2.4/upgrading.html

最新更新