在Linux上安装Squid代理服务器软件的详细步骤
[代码] 1、获取Squid源代码
1 wget http://www.squid-cache.org/Versions/v3/3.1/squid-3.1.9.tar.gz
[代码] 2、编译及安装
1 tar -zxvf squid-3.1.9.tar.gz
2 cd squid-3.1.9
3 ./configure --prefix=/usr/local/squid --enable-arp-acl --enable-linux-netfilter --enable-pthreads --enable-err-language="Simplify_Chinese" --enable-default-err-language="Simplify_Chinese" --enable-auth="basic" --enable-baisc-auth-helpers="NCSA" --enable-underscore
4 make
5 make install
[代码] 3、编译生成Squid认证程序ncsa_auth
1 cd helpers/basic_auth/NCSA/
2 make
3 cp ncsa_auth /usr/sbin/
4 cd ../../../
[代码] 4、使用htpasswd来生成用户名/密码对应的文件
1 htpasswd -c /usr/local/squid/password <用户名>
[代码] 5、修改Squid配置文件
01 cd /usr/local/squid/
02 mv -f etc/squid.conf etc/squid.conf.bak
03 vi etc/squid.conf
04
05 # 插入如下内容
06
07
08 acl SSL_ports port 443
09 acl Safe_ports port 80 # http
10 acl Safe_ports port 21 # ftp
11 acl Safe_ports port 443 # https
12 acl Safe_ports port 70 # gopher
13 acl Safe_ports port 210 # wais
14 acl Safe_ports port 1025-65535 # unregistered ports
15 acl Safe_ports port 280 # http-mgmt
16 acl Safe_ports port 488 # gss-http
17 acl Safe_ports port 591 # filemaker
18 acl Safe_ports port 777 # multiling http
19 acl CONNECT method CONNECT
20
21 auth_param basic program /usr/sbin/ncsa_auth /usr/local/squid/password
22 acl normal proxy_auth REQUIRED
23 http_access allow normal
24
25 # Deny requests to certain unsafe ports
26 http_access deny !Safe_ports
27
28 # Deny CONNECT to other than secure SSL ports
29 http_access deny CONNECT !SSL_ports
30
31 # And finally deny all other access to this proxy
32 http_access deny all
33
34 # Squid normally listens to port 3128
35 http_port 3128
36
37 # We recommend you to use at least the following line.
38 hierarchy_stoplist cgi-bin ?
39
40 # Uncomment and adjust the following to add a disk cache directory.
41 #cache_dir null /tmp
42
43 # Leave coredumps in the first cache dir
44 coredump_dir /usr/local/squid/var/cache
45
46 # Add any of your own refresh_pattern entries above these.
47 refresh_pattern ^ftp: 1440 20% 10080
48 refresh_pattern ^gopher: 1440 0% 1440
49 refresh_pattern -i (/cgi-bin/|?) 0 0% 0
50 refresh_pattern . 0 20% 4320
[代码] 6、启动Squid
1 ./sbin/squid
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
移动主题是版主的事。不过还是要顶一下!
哥们,文章发错版面了吧!