简体   繁体   English

如何配置apache服务器以允许wget与代理?

[英]How to configure apache server to allow wget with proxy?

I'm totally new to the apache httpd stuff 我对Apache httpd东西完全陌生

I setup my host ServerHost1 as a file server with httpd 我将主机ServerHost1设置为带有httpd的文件服务器

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

I have put the file TestFile.txt under /var/www/html/TestDir/TestFile.txt 我已将文件TestFile.txt放在/var/www/html/TestDir/TestFile.txt下

I modified part of the httpd.conf as follow 我修改了httpd.conf的一部分,如下所示

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

On a test host TestHost1 with full Internet access, I can downloaded my file with wget 在具有完全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 

On the host sitting on a semi-isolated network TestHost2 , I have to use proxy for wget to work. 在半隔离网络TestHost2上的主机上,我必须使用代理才能使wget正常工作。 It works fine with google 它与谷歌很好

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]

However when I try to get my file from ServerHost1, it gets ERROR 503: Service Unavailable 但是,当我尝试从ServerHost1获取文件时,它显示错误503:服务不可用

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.

So the question is 所以问题是

(1) Why am I seeing 503 ServiceUnavailable when the file is apparently available (since I can downloaded from testhost1)? (1)当文件明显可用时,为什么我看到503 ServiceUnavailable(因为我可以从testhost1下载)?

(2) How do I configure my httpd.conf file so that TestHost2 can wget the file from ServerHost1? (2)如何配置我的httpd.conf文件,以便TestHost2可以从ServerHost1中获取文件?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM