我的系统:  x86_64位Feodra 18

# yum install squid

不需要用户名密码认证的配置方式

edit /etc/squid/squid.conf

#
# Recommended minimum configuration:
#
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 # Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
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 172.16.16.0/24 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT #
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager # Deny requests to certain unsafe ports
http_access deny !Safe_ports # Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports # We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost #
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
# # Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost # And finally deny all other access to this proxy
http_access deny all # Squid normally listens to port 3128
http_port 8888 # We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ? # Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/spool/squid 100 16 256 # Leave coredumps in the first cache dir
coredump_dir /var/spool/squid # Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320

重启squid

# service squid restart

输入proxy的IP和端口号8888即可利用该proxy上网

需要用户名密码认证

edit /etc/squid/squid.conf, 注意粗体部分

edit /etc/squid/squid.confhttp_access allow localhost
http_port 8888
cache deny all
hierarchy_stoplist cgi-bin ? access_log none
cache_store_log none
cache_log /dev/null refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320 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 SSL_ports port 443
acl SSL_ports port 5656 # SolusVM SSL
acl Safe_ports port 5353 # SolusVM without SSL
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager http_access deny !Safe_ports http_access deny CONNECT !SSL_ports
auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/passwd

auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
http_access allow password
http_access deny all forwarded_for off
request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access WWW-Authenticate allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access Proxy-Connection allow all
request_header_access User-Agent allow all
request_header_access Cookie allow all
request_header_access All deny all

# htpasswd  -c /etc/squid/passwd test

New password: mypass

Re-type new password:mypass

# service squid restart

然后在浏览器上设置代理服务器的IP和端口号(8888),输入网址,应该弹出一个页面让输入代理用户名和密码,输入你设定的用户名(test)和密码(password)。

参考:

http://freevps.us/thread-9926.html

利用squid配置代理服务器-Fedora 19的更多相关文章

  1. 用squid配置代理服务器(基于Ubuntu Server 12.04)

    怀揣着为中小企业量身定做一整套开源软件解决方案的梦想开始了一个网站的搭建.http://osssme.org/ 1. 安装squid $sudo apt-get install squid -y 注: ...

  2. Fedora 19 配置参考

    1. 安装完Fedora 19之后,第一件事不是升级系统,而是添加源. 下载我配置好的源,非常全面,适用Fedora 19 x86_64.点我下载 打开终端,切换到repo.zip所在目录:mv re ...

  3. Fedora 19的U盘安装 以及简单配置

    一.Fedora19的U盘安装 2013年7月3日,Fedora 19正式版发布.Fedora 19除了GNOME桌面版之外,还提供了KDE定制版.LXDE定制版等,有兴趣的网友可以在其官网上下载试用 ...

  4. Squid 缓存代理服务器的完整配置

    Squid 缓存代理服务器 Squid 的作用 1.通过缓存的方式为用户提供web访问加速 2.对用户的web访问进行过滤控制 缓存代理服务器又分为普通代理服务器,透明代理服务器,和反向代理服务器. ...

  5. 使用Squid做代理服务器,Squid单网卡透明代理配置详解(转)

    使用Squid做代理服务器 说到代理服务器,我们最先想到的可能是一些专门的代理服务器网站,某些情况下,通过它们能加快访问互联网的速度.其实,在需要访问外部的局域网中,我们自己就能设置代理,把访问次数较 ...

  6. 利用 squid 反向代理提高网站性能(转载)

    本文在介绍 squid 反向代理的工作原理的基础上,指出反向代理技术在提高网站访问速度,增强网站可用性.安全性方面有很好的用途.作者在具体的实验环境下,利用 DNS 轮询和 Squid 反向代理技术, ...

  7. 31.Squid缓存代理服务器应用

    Squid缓存代理服务器应用 Squid安装介绍 web缓存的工作机制 缓存网页对象,减少重复请求 squid 主要提供缓存加速.应用层过滤控制的功能. 工作机制 代替客户机问网站请求数据,从而可以隐 ...

  8. 使用squid配置透明代理并对上网行为进行控制

    使用Squid配置透明代理 环境:CentOS 6.4 + squid-3.1.10-20.el6_5.3.x86_64 1.检查squid是否默认安装,没有安装先安装 rpm -qa squid 假 ...

  9. Fedora 19 vim c语言开发环境

    1. Fedora 19 居然没有自带 gcc 和 g++: sudo yum -y install gcc gcc-c++ 2. 安装 vim 和 cvim 插件: sudo yum -y vim ...

随机推荐

  1. 前端读者 | 前端面试基础手册(HTML+CSS)

    本文来自@羯瑞:希望前端面试基础手册能帮助要找工作的前端小伙伴~~ HTML 前端需要注意哪些SEO? 合理的title.description.keywords:搜索对着三项的权重逐个减小,titl ...

  2. poj1743 后缀数组, poj挂了 存个代码

    #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk mak ...

  3. 【ASP.NET MVC】 路由机制:命名路由

    首先看一下命名路由和没有命名的差别: 命名路由: routes.MapRoute( name: "Test", // Route name url: "code/p/{a ...

  4. python 字符集转换-灰常慢

    代码 def toUni (text): str = text try: charstyle = chardet.detect(text) # print 'confidence: ', charst ...

  5. scrapy 安装出错 [err2] no such file or directory: 'README.rst'【已解决】

    背景:pip安装一直不成功,很多模块用pip安装都不行,只好到github下载zip安装 c:\Document and settings\> python e:\scrapy-0.24\set ...

  6. Mysql数据库表的类型有哪些

    截至目前,MySQL一共向用户提供了包括DBD.HEAP.ISAM.MERGE.MyIASM.InnoDB以及Gemeni这7种Mysql表类型.其中DBD.InnoDB属于事务安全类表,而其他属于事 ...

  7. Codeforces 补题记录

    首先总结一下前段时间遇到过的一些有意思的题. Round #474 (Div. 1 + Div. 2, combined)   Problem G 其实关键就是n这个数在排列中的位置. 这样对于一个排 ...

  8. Arduino可穿戴开发入门教程LilyPad介绍

    Arduino可穿戴开发入门教程LilyPad介绍 Arduino输出模块 LilyPad官方共提供了4种输出模块,他们分别是单色LED模块(图1.5).三色LED模块(图1.6).蜂鸣器模块(图1. ...

  9. AtCoder - 3954 Painting Machines

    题面在这里! 题解见注释 /* 考虑一个可以用 K ((n+1)/2 <= K < n)次染黑的方案, 那么将操作前K次的机器从小到大排序,一定是: a1=1 < a2 < . ...

  10. BZOJ 2430 [Poi2003]Chocolate(贪心+归并排序)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=2430 [题目大意] 有一块n*m的矩形巧克力,准备将它切成n*m块. 巧克力上共有n- ...