我的系统:  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. 760. Find Anagram Mappings

    Given two lists Aand B, and B is an anagram of A. B is an anagram of A means B is made by randomizin ...

  2. react生命周期函数使用箭头函数,导致mobx-react问题

    最近新人加入了项目,遇到了一个很奇怪的问题.mobx observable 属性,onChange的时候就是页面不会刷新. 试来试去,就是不知道什么原因,后来其他同事查到是因为componentWil ...

  3. js实现图片下载

    <img src='src' data-name='自定义名称'><script>//js实现图片下载 function download(){ var name = $('# ...

  4. 【转载】C++之继承与多态

    转自:http://www.cnblogs.com/kunhu/p/3631285.html 在程序设计领域,一个广泛认可的定义是“一种将不同的特殊行为和单个泛化记号相关联的能力”.和纯粹的面向对象程 ...

  5. "The /usr/local directory is not writable."解决方法

    sudo chown -R $(whoami) /usr/local brew prune

  6. Codeforces 1131 A. Sea Battle-暴力 (Codeforces Round #541 (Div. 2))

    A. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  7. Xamarin.Forms教程下载安装Visual Studio 2015

    Xamarin.Forms教程下载安装Visual Studio 2015 下载安装Visual Studio 2015 Visual Studio 2015是微软提供的IDE,其中集成了Window ...

  8. JZYZOJ1371 青蛙的约会 扩展欧几里得 GTMD数论

    http://172.20.6.3/Problem_Show.asp?id=1371 题意是两个青蛙朝同一个方向跳 http://www.cnblogs.com/jackge/archive/2013 ...

  9. MySql数据库理解

    在之前的面试过程中,有被问到很多次,关于MySQL数据库相关知识,其中有问到了解存储引擎,数据库优化等问题,问得一脸懵X,确实以前在学习的时候没有去深入了解过这一块儿,今天找到了相应的数据库视频,稍稍 ...

  10. Java编程思想学习(三)----第三章:操作符

    3.2使用Java操作符 操作符接受一个或多个参数,并生成一个新值. 操作符作用于操作数,生成一个新值.有些操作符可以改变操作数自身的值.几乎所以的操作符都只能操作“基本类型”.例外的操作符有“=”, ...