wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
rpm -ivh ./rpmforge....
yum install nload -y
rz nginx
tar -zxvf ./nginx-1.3.0.tar.gz && cd nginx-1.3.0 && ./configure --without-http_rewrite_module && make && make install && cd /usr/local/nginx && pwd && vi ./conf/nginx.conf
tar -zxvf ./nginx-1.3.0.tar.gz && cd nginx-1.3.0 && ./configure && make && make install && cd /usr/local/nginx && pwd && vi ./conf/nginx.conf
Traceback (most recent call last):
File "./test_proxy.py", line 10, in <module>
html=urllib2.urlopen(req).read()
File "/opt/python2.6/lib/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/opt/python2.6/lib/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/opt/python2.6/lib/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/opt/python2.6/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/opt/python2.6/lib/python2.6/urllib2.py", line 1161, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/opt/python2.6/lib/python2.6/urllib2.py", line 1136, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 113] No route to host>
service iptables stop
server {
resolver 202.106.0.20;
resolver_timeout 5s;
listen 0.0.0.0:80;
location / {
proxy_pass $scheme://$host$request_uri;
proxy_set_header Host $http_host;
proxy_buffers 256 4k;
proxy_max_temp_file_size 0;
proxy_connect_timeout 30;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 301 1h;
proxy_cache_valid any 1m;
}
}}
./sbin/nginx -t
./sbin/nginx -c ./conf/nginx.conf
ps -ef|grep nginx
#!/usr/bin/env python
#encoding=utf-8
import urllib2
while True:
proxy_handler=urllib2.ProxyHandler({'http' : 'http://127.0.0.1:80'})
opener = urllib2.build_opener(proxy_handler)
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib2.install_opener(opener)
url="http://www.baidu.com"
req=urllib2.Request(url)
html=urllib2.urlopen(req).read()
print html
import time
time.sleep(0.1)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)