0

在过去的两天里,我们试图让 squid 2.7 与 ubuntu 9.10 一起工作。运行 ubuntu 的计算机有两个网络接口:eth0 和 eth1,dhcp 在 eth1 上运行。两个接口都有静态 IP,eth0 连接到 Internet,eth1 连接到我们的 LAN。

我们实际上已经遵循了几十个不同的教程,但都没有成功。这里的教程是我们做的最后一个,它实际上给了我们一些结果:http ://www.basicconfig.com/linuxnetwork/setup_ubuntu_squid_proxy_server_beginner_guide 。

当我们尝试从 LAN 访问像 Seriouswheels.com 这样的网站时,我们会在客户端机器上收到以下消息:


错误

所请求的网址无法检索

尝试处理请求时遇到无效请求错误:

GET / HTTP/1.1
主机:www.seriouswheels.com
连接:keep-alive
用户代理:Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.11 Safari/532.9
Cache-Control: max-age=0
Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png, / ;q=0.5 Accept -编码:gzip,deflate,sdch Cookie:__utmz=88947353.1269218405.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); __qca=P0-1052556952-1269218405250; __utma=88947353.1027590811.1269218405.1269218405.1269218405.1;__qseg=Q_D Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

一些可能的问题是:

缺少或未知的请求方法。

缺少网址。

缺少 HTTP 标识符 (HTTP/1.0)。

请求过大。

POST 或 PUT 请求缺少内容长度。

主机名中的非法字符;不允许使用下划线。

您的缓存管理员是网站管理员。


以下是所有配置文件:/etc/squid/squid.conf、/etc/network/if-up.d/00-firewall、/etc/network/interfaces、/var/log/squid/access.log。某处有问题,但我们无法弄清楚在哪里。

我们所有这一切的最终目标是将内容叠加到客户端在 LAN 上请求的每个页面上。我们被告知 squid 是执行此操作的方法,但在游戏的这一点上,我们只是试图正确设置 squid 作为我们的代理。

提前致谢。

squid.conf

acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl localnet src 192.168.0.0/24
acl SSL_ports port 443 # https
acl SSL_ports port 563 # snews
acl SSL_ports port 873 # rsync
acl Safe_ports 端口 80 # http
acl Safe_ports 端口 21 # ftp
acl Safe_ports 端口 443 # https
acl Safe_ports 端口 70 # gopher
acl Safe_ports 端口 210 # wais
acl Safe_ports 端口 1025-65535 # 未注册端口
acl Safe_ports 端口 280 # http-mgmt
acl Safe_ports 端口488 # gss-http
acl Safe_ports 端口 591 # filemaker
acl Safe_ports 端口 777 # 多重 http
acl Safe_ports 端口 631 # cups
acl Safe_ports 端口 873 # rsync
acl Safe_ports 端口 901 # SWAT
acl 清除方法 PURGE
acl CONNECT 方法 CONNECT
http_access 允许管理器 localhost
http_access 拒绝管理器
http_access 允许清除 localhost
http_access 拒绝清除
http_access 拒绝! Safe_ports
http_access 拒绝 CONNECT !SSL_ports
http_access 允许 localhost
http_access 允许 localnet
http_access 拒绝所有
icp_access 允许 localnet
icp_access 拒绝所有
http_port 3128
hierarchy_stoplist cgi-bin ?
cache_dir ufs /var/spool/squid/cache1 1000 16 256
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package (.gz)*)$ 0 20% 2880
刷新模式。0 20% 4320
acl 广播 rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 拒绝广播
acl apache rep_header 服务器 ^Apache
broken_vary_encoding 允许 apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
cache_mgr webmaster
cache_effective_user proxy
cache_effective_group proxy
hosts_file /etc /hosts
coredump_dir /var/spool/squid


访问日志


1269243042.740 0 192.168.1.11 TCP_DENIED/400 2576 GET NONE:// - NONE/- text/html


00-防火墙

iptables -F iptables -t nat -F iptables -t mangle -F iptables -X

回声 1 | 三通 /proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -j MASQUERADE

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3128


联网

自动 lo
iface lo inet 环回

auto eth0
iface eth0 inet 静态
地址 142.104.109.179
网络掩码 255.255.224.0
网关 142.104.127.254

auto eth1
iface eth1 inet 静态
地址 192.168.1.100
网络掩码 255.255.255.0


4

1 回答 1

0

此问题已移至https://serverfault.com/questions/125624/modify-html-content-with-squid

于 2010-07-27T00:49:47.183 回答