- 论坛徽章:
- 0
|
小弟初始接触 squid 听说这代理可以加速动态网页,并可以解决apache的负载问题,
在网上收集了不少资料, 但是今天配置了一下,尝未成功. 所以请各位朋友帮助,或给个详细的配置方法,谢谢!
我的版本配置方法如下
squid-2.6.STABLE16-1.fc7
httpd-2.2.4-4.1.fc7
httpd.conf 端口有80改为8080 测试正常, 所以apache 没有问题,
squid.conf 配置如下
- acl all src 0.0.0.0/0.0.0.0
- acl manager proto cache_object
- acl localhost src 127.0.0.1/255.255.255.255
- acl to_localhost dst 127.0.0.0/8
- acl SSL_ports port 443
- acl Safe_ports port 8080 # http
- acl Safe_ports port 443 # https
- acl Safe_ports port 1025-65535 # unregistered ports
- acl CONNECT method CONNECT
- acl apache rep_header Server ^Apache
- broken_vary_encoding allow apache
- collapsed_forwarding on
- http_access deny all
- http_access allow manager localhost
- http_access deny manager
- http_access deny !Safe_ports
- http_access deny CONNECT !SSL_ports
- http_access allow localhost
- http_access deny all
- http_reply_access allow all
- icp_access deny all
- http_port 80
- reply_header_max_size= 4000 KB
- reply_body_max_size 0 allow all
- acl QUERY urlpath_regex cgi-bin \?
- cache deny QUERY
- cache_mem 16 MB
- maximum_object_size_in_memory 8 KB
- cache_replacement_policy lru
- cache_dir ufs /home/cache 10000 16 256
- max_open_disk_fds 0
- minimum_object_size 0 KB
- maximum_object_size 8192 KB
- cache_swap_low 80
- cache_swap_high 85
- access_log /var/log/squid/access.log squid
- cache_log /var/log/squid/cache.log
- cache_store_log /var/log/squid/store.log
- cache_mgr [email]sky@test.com[/email]
- cache_effective_user squid
- cache_effective_group squid
- emulate_httpd_log on
- mime_table /etc/squid/mime.conf
- log_mime_hdrs off
- pid_filename /var/run/squid.pid
- client_netmask 255.255.255.0
- vary_ignore_expire on
- request_entities on
- httpd_suppress_version_string on
- visible_hostname 192.168.18.199
- hostname_aliases 192.168.18.199
- httpd_accel_no_pmtu_disc on
- #dns_nameservers 10.0.0.1 192.172.0.4
- append_domain .yourdomain.com
- ignore_unknown_nameservers on
- client_db on
- max_filedesc 2048
复制代码
squid -z 没有错误,
service squid restart 重启没有错误,
好了到IE浏览器 输入 http://192.168.18.199 时候出现如下错误
- ERROR
- The requested URL could not be retrieved
- --------------------------------------------------------------------------------
- While trying to process the request:
- GET / HTTP/1.1
- Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
- Accept-Language: zh-cn
- UA-CPU: x86
- Accept-Encoding: gzip, deflate
- User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; Mozilla/4.0(Compatible Mozilla/4.0(Compatible-EmbeddedWB 14.59 [url]http://bsalsa.com/[/url] EmbeddedWB- 14.59 from: [url]http://bsalsa.com/[/url] ; Mozilla/4.0(Compatible Mozilla/4.0EmbeddedWB- 14.59 from: [url]http://bsalsa.com/[/url] ; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
- Host: 192.168.18.199
- Connection: Keep-Alive
- The following error was encountered:
- Invalid Request
- Some aspect of the HTTP Request is invalid. Possible problems:
- Missing or unknown request method
- Missing URL
- Missing HTTP Identifier (HTTP/1.0)
- Request is too large
- Content-Length missing for POST or PUT requests
- Illegal character in hostname; underscores are not allowed
- Your cache administrator is [email]sky@test.com[/email].
- --------------------------------------------------------------------------------
- Generated Tue, 25 Sep 2007 09:49:25 GMT by 192.168.18.199 (squid/2.6.STABLE16)
复制代码
这证明了squid 起到了作用,但是为什么打不开里面的网站内容
如输入 http://192.168.18.199:8080 即正常,因为这是直接连接到apache 服务里,并没用到代理,
所以请各位帮忙一下, |
|