【资料整理】squid安装和配置代理上网
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
1. 安装
[root@test230 ~]
# yum install squid
2. 配置
squid配置文件
[root@test230 ~]
# vim /etc/squid/squid.conf
增加:
##############################
### 基础信息
##############################
visible_hostname Proxy_test230
cache_mgr PC@ec.office
##############################
### 日志
##############################
emulate_httpd_log on
# regular
#logformat combined [%tl] %6tr %>a %Ss/%>Hs %<st %rm %ru %un %Sh/%<A %mt
# apache
logformat combined %>a %ui %un [%tl]
"%rm %ru HTTP/%rv"
%>Hs %<st
"%{Referer}>h"
"%{User-Agent}>h"
%Ss:%Sh %{host}>h
access_log
/var/log/squid/access
.log combined
logfile_rotate 3
##############################
### 用户验证
##############################
# password file
# htpasswd -c /etc/squid/squid.passwd ecuser
#
auth_param basic program
/usr/lib64/squid/ncsa_auth
/etc/squid/squid
.
passwd
auth_param basic realm
"[Proxy Server] hello!"
auth_param basic credentialsttl 12 hours
auth_param basic children 5
修改:
# CONNECT 仅允许 SSL_ports列出的端口
#acl SSL_ports port 443
acl SSL_ports port 443 80 1863 8080
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
# 取消以下2行的注释,使用auth功能
#acl need_auth proxy_auth REQUIRED
#http_access allow need_auth
3. 启动
[root@test230 ~]
# squid -k parse
2014
/12/19
17:42:40| Processing Configuration File:
/etc/squid/squid
.conf (depth 0)
2014
/12/19
17:42:40| Initializing https proxy context
[root@test230 ~]
# service squid start
Starting squid: . [ OK ]
4. 测试
代理ip端口: 192.168.1.230:3128
|
注意CONNECT方法非常特殊。它是用于通过HTTP代理来封装某种请求的方法。上述配置中,客户端仅能通过CONNECT方法连接远程服务器的443,80,1863,8080端口
本文转自 pcnk 51CTO博客,原文链接:http://blog.51cto.com/nosmoking/1595647,如需转载请自行联系原作者