squid 不能代理。

回复 收藏
本帖最后由 236671307 于 2015-12-29 11:03 编辑

[root@yhoo ~]# vi /etc/squid/squid.conf                             #直接copy教程的参数


visible_hostname squid-bb
http_port 3128
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80 8080         # http
acl Safe_ports port 21          # ftp
acl Safe_ports port 443         # https
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access allow all
cache_dir aufs /data/cache 1024 16 256
cache_mem 128 MB
hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|\?) 0     0%      0
refresh_pattern \.(jpg|png|gif|mp3|xml) 1440    50%     2880    ignore-reload
refresh_pattern .               0       20%     4320


#########################################################################
[root@yhoo ~]# curl -xlocalhost:3128 news.qq.com -I               #错误提示 这个已经解决。 IE代理还是上不了网
HTTP/1.0 403 Forbidden
Server: squid/3.1.23
Mime-Version: 1.0
Date: Sat, 12 Dec 2015 00:54:13 GMT
Content-Type: text/html
Content-Length: 3258
X-Squid-Error: ERR_ACCESS_DENIED 0
Vary: Accept-Language
Content-Language: en
X-Cache: MISS from squid-bb
X-Cache-Lookup: NONE from squid-bb:3128
Via: 1.0 squid-bb (squid/3.1.23)
Connection: keep-alive

#################################################################
[root@yhoo ~]# ping www.baidu.com                                                    #网络是没问题的
PING www.a.shifen.com (14.215.177.37) 56(84) bytes of data.
64 bytes from 14.215.177.37: icmp_seq=1 ttl=128 time=38.8 ms
64 bytes from 14.215.177.37: icmp_seq=2 ttl=128 time=5.21 ms
64 bytes from 14.215.177.37: icmp_seq=3 ttl=128 time=5.65 ms


#################################################

[root@yhoo ~]# ps aux|grep squid                                     #启动正常,但没3128端口


root       4551  0.0  0.7  73980  3568 ?        Ss   08:43   0:00 squid -f /etc/squid/squid.conf
squid      4554  0.0  2.1  76044 10272 ?        S    08:43   0:00 (squid) -f /etc/squid/squid.conf
squid      4574  0.0  0.2  20084  1068 ?        S    08:43   0:00 (unlinkd)
root       4642  0.0  0.7  71904  3548 ?        Ss   08:48   0:00 squid -f /etc/squid/squid.conf
squid      4645  0.0  2.2  74360 10968 ?        S    08:48   0:00 (squid) -f /etc/squid/squid.conf
squid      4646  0.0  0.2  20084  1072 ?        S    08:48   0:00 (unlinkd)
root       4684  0.0  0.1 103316   896 pts/1    S+   09:01   0:00 grep squid

#############################################################


[root@yhoo ~]# netstat -anl |grep 3128                                                          #显示在监听端口

tcp        0      0 :::3128                     :::*                        LISTEN



2015-12-29 10:01 举报
已邀请:
0

236671307

赞同来自:

本帖最后由 236671307 于 2015-12-29 10:27 编辑

用IE代理上不了网。Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.
0

236671307

赞同来自:


[root@yhoo ~]# cat /var/log/squid/cache.log

2015/12/12 09:10:05| WARNING: 'yhoo' rDNS test failed: (110) Connection timed out
2015/12/12 09:10:05| WARNING: Could not determine this machines public hostname. Please configure one or set 'visible_hostname'.
2015/12/12 09:10:20| WARNING: 'yhoo' rDNS test failed: (110) Connection timed out
2015/12/12 09:10:20| WARNING: Could not determine this machines public hostname. Please configure one or set 'visible_hostname'.
2015/12/12 09:10:35| WARNING: 'yhoo' rDNS test failed: (110) Connection timed out
2015/12/12 09:10:35| WARNING: Could not determine this machines public hostname. Please configure one or set 'visible_hostname'.
################################################

[root@yhoo ~]# cat /var/log/squid/access.log


1449882436.026      0 192.168.119.1 TCP_DENIED/403 3632 GET http://top.baidu.com/rss_xml.php? - NONE/- text/html
1449882445.682      0 192.168.119.1 TCP_DENIED/403 3625 GET http://123.timeon.cn/minisite.html - NONE/- text/html
1449882475.685      1 192.168.119.1 TCP_DENIED/403 3625 GET http://123.timeon.cn/minisite.html - NONE/- text/html
1449882496.028      1 192.168.119.1 TCP_DENIED/403 3632 GET http://top.baidu.com/rss_xml.php? - NONE/- text/html
1449882496.800      0 192.168.119.1 TCP_DENIED/403 4174 POST http://client.show.qq.com/cgi-bin/qqshow_user_props_info - NONE/- text/html
1449882505.687      1 192.168.119.1 TCP_DENIED/403 3625 GET http://123.timeon.cn/minisite.html - NONE/- text/html
1449882524.333  61249 192.168.119.1 TCP_MISS/503 0 CONNECT clients2.google.com:443 - DIRECT/74.125.23.139 -
[root@yhoo ~]#
0

236671307

赞同来自:

l[root@yhoo ~]# curl -xlocalhost:3128 news.qq.com -I               #错误提示 已解决,原因是要指定到具体的文件

[root@yhoo ~]#curl -xlocalhost:3128 h ttps://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png -I


IE还是上不了
0

236671307

赞同来自:

把所有deny 行注释掉算是可以了.    {:4_99:}
0

gjc159357

赞同来自:

正向代理用的不是很多吧    反向代理应该比较常见,最近在搞反向代理,跟着帖子配置应该是没问题的
0

236671307

赞同来自:

{:4_111:}在公司可以,在宿舍还是不行,唉,郁闷

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: