客户端被服务器配置拒绝

发布于 2024-12-20 08:06:38 字数 395 浏览 3 评论 0原文

我尝试将 kohana 3 项目设置为虚拟主机。

配置:

<VirtualHost *:80>
  DocumentRoot "D:/Devel/matysart/matysart_dev1"
  ServerName matysart-one.local
  ServerAlias www.matysart-one.local
  DirectoryIndex index.php
</VirtualHost>

错误(403):

[客户端 127.0.0.1] 客户端被服务器配置拒绝: D:/Devel/matysart/matysart_dev1/

有人可以帮忙吗?

I try to setup kohana 3 project as virtual host.

Config:

<VirtualHost *:80>
  DocumentRoot "D:/Devel/matysart/matysart_dev1"
  ServerName matysart-one.local
  ServerAlias www.matysart-one.local
  DirectoryIndex index.php
</VirtualHost>

Error (403):

[client 127.0.0.1] client denied by server configuration:
D:/Devel/matysart/matysart_dev1/

Could somebody help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

烈酒灼喉 2024-12-27 08:06:38

就我而言,我修改了目录标签。

<Directory "D:/Devel/matysart/matysart_dev1">
  Allow from all
  Order Deny,Allow
</Directory>

<Directory "D:/Devel/matysart/matysart_dev1">
  Require local
</Directory>

而且它确实有效。 Apache 2.4.2 似乎有所改变。

In my case, I modified directory tag.

From

<Directory "D:/Devel/matysart/matysart_dev1">
  Allow from all
  Order Deny,Allow
</Directory>

To

<Directory "D:/Devel/matysart/matysart_dev1">
  Require local
</Directory>

And it seriously worked. It's seems changed with Apache 2.4.2.

混吃等死 2024-12-27 08:06:38

对我来说,以下工作是从 /etc/apache2/apache2.conf 中的示例复制的:

<Directory /srv/www/default>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

Require all granted 选项是 wiki.apache.org 页面专门针对 Apache 2.4+ 版本的此问题。

有关 Require 选项的更多详细信息可以在 mod_authz 模块的官方 apache 页面 以及此页面。即:

要求所有已授予 ->无条件允许访问。

For me the following worked which is copied from example in /etc/apache2/apache2.conf:

<Directory /srv/www/default>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

Require all granted option is the solution for the first problem example in wiki.apache.org page dedicated for this issue for Apache version 2.4+.

More details about Require option can be found on official apache page for mod_authz module and on this page too. Namely:

Require all granted -> Access is allowed unconditionally.

纵山崖 2024-12-27 08:06:38

错误“客户端被服务器配置拒绝”通常意味着配置中的某个位置存在阻止访问的 Allow fromDeny from 指令。有关更多详细信息,请阅读 mod_authz_host 文档。

您应该能够在 VirtualHost 中通过添加以下内容来解决此问题:

<Location />
  Allow from all
  Order Deny,Allow
</Location>

或者使用 Directory 指令:

<Directory "D:/Devel/matysart/matysart_dev1">
  Allow from all
  Order Deny,Allow
</Directory>

对 Apache 配置文件进行一些调查可能会发现对默认 DocumentRoot 的默认限制。

The error "client denied by server configuration" generally means that somewhere in your configuration are Allow from and Deny from directives that are preventing access. Read the mod_authz_host documentation for more details.

You should be able to solve this in your VirtualHost by adding something like:

<Location />
  Allow from all
  Order Deny,Allow
</Location>

Or alternatively with a Directory directive:

<Directory "D:/Devel/matysart/matysart_dev1">
  Allow from all
  Order Deny,Allow
</Directory>

Some investigation of your Apache configuration files will probably turn up default restrictions on the default DocumentRoot.

新人笑 2024-12-27 08:06:38

就我而言,

我使用的是 macOS Mojave (Apache/2.4.34)。 /etc/apache2/extra/httpd-vhosts.conf 文件中的虚拟主机设置存在问题。添加所需的目录标签后,我的问题就消失了。

需要所有授权

希望完整的虚拟主机设置结构能够拯救您。

<VirtualHost *:80>
    DocumentRoot "/Users/vagabond/Sites/MainProjectFolderName/public/"
    ServerName project.loc

    <Directory /Users/vagabond/Sites/MainProjectFolderName/public/>
        Require all granted
    </Directory>

    ErrorLog "/Users/vagabond/Sites/logs/MainProjectFolderName.loc-error_log"
    CustomLog "/Users/vagabond/Sites/logs/MainProjectFolderName.loc-access_log" common
</VirtualHost>

您只需将 MainProjectFolderName 替换为您的确切 ProjectFolderName 即可。

in my case,

i'm using macOS Mojave (Apache/2.4.34). There was an issue in virtual host settings at /etc/apache2/extra/httpd-vhosts.conf file. after adding the required directory tag my problem was gone.

Require all granted

Hope the full virtual host setup structure will save you.

<VirtualHost *:80>
    DocumentRoot "/Users/vagabond/Sites/MainProjectFolderName/public/"
    ServerName project.loc

    <Directory /Users/vagabond/Sites/MainProjectFolderName/public/>
        Require all granted
    </Directory>

    ErrorLog "/Users/vagabond/Sites/logs/MainProjectFolderName.loc-error_log"
    CustomLog "/Users/vagabond/Sites/logs/MainProjectFolderName.loc-access_log" common
</VirtualHost>

all you've to do replace the MainProjectFolderName with your exact ProjectFolderName.

梨涡少年 2024-12-27 08:06:38

这对我有用..

<Location />
 Allow from all
 Order Deny,Allow
</Location>

我已将此代码包含在我的 /etc/apache2/apache2.conf 中

this worked for me..

<Location />
 Allow from all
 Order Deny,Allow
</Location>

I have included this code in my /etc/apache2/apache2.conf

倾城泪 2024-12-27 08:06:38

我的服务器有正确的主机和 IP 列表。这些都不允许所有内容。我的解决方法是将新工作站的主机名放入列表中。因此建议是:

确保您使用的计算机实际上位于允许的 IP 列表中。从日志消息中查看 IP,解析名称,检查 ifconfig / ipconfig 等。

*Google 由于错误消息而向我发送了信息。

I have servers with proper lists of hosts and IPs. None of that allow all stuff. My fix was to put the hostname of my new workstation into the list. So the advise is:

Make sure the computer you're using is ACTUALLY on the list of allowed IPs. Look at IPs from logmessages, resolve names, check ifconfig / ipconfig etc.

*Google sent me due to the error-message.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文