apache 代理模块给出 403 禁止错误

发布于 2024-09-15 05:47:18 字数 1277 浏览 8 评论 0 原文

我正在尝试使用 apache 的代理模块在 ubuntu 桌面上使用 xmpp 。为此,我做了以下事情 -

1)通过在 mods-enabled 目录中的 /etc/apache2/mods-available/ 创建 proxy.conf、proxy.load 和 proxy_http.load 的符号链接来启用 mod_proxy。

2)将以下几行添加到虚拟主机中

    <Proxy http://mydomain.com/httpbind>
     Order allow,deny
     Allow from all
   </Proxy>

   ProxyPass /httpbind http://mydomain.com:7070/http-bind/
   ProxyPassReverse /httpbind http://mydomain.com:7070/http-bind/

我刚开始使用代理模块,但我可以从上面几行中得到的是,对 http://mydomain.com/httpbind 的请求将被转发到http://mydomain.com:7070/http-bind/。如有错误敬请指正。

3)在 /mods-available/proxy.conf 添加规则 Allow from .mydomain.com

现在我尝试访问 http://mydomain.com/httpbind 并显示403 禁止错误..

我在这里缺少什么?请帮忙。谢谢

时,问题得到了解决

    <Proxy *>
            AddDefaultCharset off
            Order deny,allow
    Deny from all 
    Allow from mydomain.com                        
    </Proxy>

编辑:当我将 mods_available/proxy.conf 中的以下代码更改为“

    <Proxy *>
            AddDefaultCharset off
            Order deny,allow
    #Deny from all 
    Allow from all                         
    </Proxy>

没有明白初始代码有什么问题”

I am trying to use the apache's proxy module for working with xmpp on ubuntu desktop. For this i did the following things -

1) enabled mod_proxy by creating a symlink of proxy.conf, proxy.load and proxy_http.load from /etc/apache2/mods-available/ in the mods-enabled directory.

2) Added the following lines to the vhost

    <Proxy http://mydomain.com/httpbind>
     Order allow,deny
     Allow from all
   </Proxy>

   ProxyPass /httpbind http://mydomain.com:7070/http-bind/
   ProxyPassReverse /httpbind http://mydomain.com:7070/http-bind/

I am new to using the proxy module but what i can make from the above lines is that requests to http://mydomain.com/httpbind will be forwarded to http://mydomain.com:7070/http-bind/. Kindly correct if wrong.

3) added rule Allow from .mydomain.com in /mods-available/proxy.conf

Now i try to access http://mydomain.com/httpbind and it shows 403 Forbidden error..

What am i missing here ? Please help. thanks

Edit : The problem got solved when i changed the following code in mods_available/proxy.conf

    <Proxy *>
            AddDefaultCharset off
            Order deny,allow
    Deny from all 
    Allow from mydomain.com                        
    </Proxy>

to

    <Proxy *>
            AddDefaultCharset off
            Order deny,allow
    #Deny from all 
    Allow from all                         
    </Proxy>

Didnt get what was wrong with the initial code though

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

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

发布评论

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

评论(2

迷鸟归林 2024-09-22 05:47:18

我知道这是一个老问题,但我在谷歌搜索中遇到了它。只是快速解释为什么代码最初不起作用。

在您的代理定义中,您定义“订单拒绝,允许”。这意味着拒绝语句将优先于允许语句。您的配置中有“拒绝所有人”。由于这是优先的,所以如果你有“允许所有人”并不重要,它仍然会拒绝所有。

I know this is an old question, but I came accross it in a google search. Just a quick explaination of why the code didn't work initially.

In your proxy definition, you define "Order deny,allow". This means that deny statements will take precedence over allow statements. You had "Deny from all" in your config. As this takes precedence, it doesn't matter if you have "allow from all", it would still deny all.

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