免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3572 | 回复: 2
打印 上一主题 下一主题

在Linux上安装Squid代理服务器软件的详细步骤 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-01-14 12:50 |只看该作者 |倒序浏览
[代码] 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

论坛徽章:
0
2 [报告]
发表于 2011-02-20 22:46 |只看该作者
哥们,文章发错版面了吧!

论坛徽章:
0
3 [报告]
发表于 2011-03-02 09:54 |只看该作者
移动主题是版主的事。不过还是要顶一下!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP