【问题标题】:How to configure apache server to allow wget with proxy?如何配置 apache 服务器以允许 wget 代理?
【发布时间】:2016-03-17 18:07:19
【问题描述】:

我对 apache httpd 的东西完全陌生

我将我的主机 ServerHost1 设置为带有 h​​ttpd 的文件服务器

# httpd -v
Server version: Apache/2.4.6 (Red Hat Enterprise Linux)
Server built:   Dec  2 2014 08:09:42

我已将文件 TestFile.txt 放在 /var/www/html/TestDir/TestFile.txt 下

我修改了httpd.conf的一部分,如下

<Directory />
    Order deny,allow
    Allow from all
</Directory>

在具有完全 Internet 访问权限的测试主机 TestHost1 上,我可以使用 wget 下载我的文件

TestHost1]# wget http://ServerHost1/TestDir/TestFile.txt
--2016-03-17 13:39:12--  http://ServerHost1/TestDir/TestFile.txt
Resolving ServerHost1 (ServerHost1)... <IP address>
Connecting to ServerHost1 (ServerHost1)|<IP address>|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2859976598 (2.7G) [application/octet-stream]
Saving to: ‘TestFile.txt’

2% [>                                                            ] 60,645,376  24.0MB/s 

在位于半隔离网络 TestHost2 上的主机上,我必须使用代理才能使 wget 工作。它适用于谷歌

TestHost2]# wget google.ca
--2016-03-17 13:53:26--  http://google.ca/
Resolving proxy.com (proxy.com)... <ProxyIP>
Connecting to proxy.com (proxy.com)|<ProxyIP>|:3128... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.ca/ [following]
--2016-03-17 13:53:26--  http://www.google.ca/
Reusing existing connection to proxy.com:3128.
Proxy request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

    [ <=>                                   ] 19,928      --.-K/s   in 0.1s

2016-03-17 13:53:27 (159 KB/s) - ‘index.html’ saved [19928]

但是,当我尝试从 ServerHost1 获取文件时,它会收到 ERROR 503: Service Unavailable

TestHost2]# wget http://ServerHost1/TestDir/TestFile.txt
--2016-03-17 13:57:13--  http://ServerHost1/TestDir/TestFile.txt
Resolving proxy.com (proxy.com)...<ProxyIP>
Connecting to proxy.com (proxy.com)|<ProxyIP>|:3128... connected.
Proxy request sent, awaiting response... 503 Service Unavailable
2016-03-17 13:57:13 ERROR 503: Service Unavailable.

所以问题是

(1) 为什么我看到 503 ServiceUnavailable 当文件明显可用时(因为我可以从 testhost1 下载)?

(2) 如何配置我的 httpd.conf 文件,以便 TestHost2 可以从 ServerHost1 获取文件?

【问题讨论】:

    标签: apache proxy wget httpd.conf


    【解决方案1】:

    也许尝试使用 ProxyRequests,如 Apache 文档 https://httpd.apache.org/docs/2.4/mod/mod_proxy.html 中所述

    【讨论】:

      猜你喜欢
      • 2011-01-01
      • 2013-09-13
      • 2019-08-21
      • 2012-09-13
      • 1970-01-01
      • 1970-01-01
      • 2022-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多