- 浏览: 145664 次
文章分类
最新评论
-
yajie:
写的一知半解,丁你个费!
数据挖掘(协同过滤、关联推荐、聚类分类)一些资料 -
xo_knight:
7.0有什么新的功能和改变吗
MyEclipse7.0相关备忘 -
kjj:
# <interceptor-ref name=&quo ...
Struts2 Action方法执行两次的问题?model-driven奇怪现象 -
xuhuasen:
我工程只是在ajax异步发送action方法时才执行了两次,检 ...
Struts2 Action方法执行两次的问题?model-driven奇怪现象 -
azure1898:
可能是你的提交按钮是submit类型,并且在按钮的onclic ...
Struts2 Action方法执行两次的问题?model-driven奇怪现象
apache(81端口)+squid(80端口)(apache和squid跑在同一个机器上面 要实现反向代理 )我将我的外网域名用abc.com代替了
apache简单配置如下:
Listen 81
NameVirtualHost *
<VirtualHost *>
<Directory "/usr/local/www/">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Satisfy all
</Directory>
ServerName www.abc.com
ServerAdmin webadmin@abc.com
DocumentRoot "/usr/local/www/"
DirectoryIndex index.jsp
# ErrorLog "/usr/local/apache/logs/abc-error_log"
# SetEnvIf Remote_Addr "::1" dontlog
# CustomLog "/usr/local/apache/logs/abc-access_log" combined env=!dontlog
</VirtualHost>
此时可以通过lsof -i:81查看谁占用81端口
确保http://www.abc.com:81 访问没有问题得到的是/usr/local/www发布的站点
开始squid的安装配置:
wget http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE2.tar.gz
#useradd squid
#groupadd squid
#tar zxvf squid-3.0.STABLE2.tar.gz
#cd squid-3.0.STABLE2
#./configure --prefix=/usr/local/squid --disable-carp --with-aufs-threads=32 --with-pthreads --enable-storeio='ufs,aufs,coss,null' --enable-disk-io='AIO,Blocking' --enable-removal-policies='heap,lru' --disable-wccp --enable-kill-parent-hack --disable-snmp --disable-poll --disable-select --enable-auth=basic --with-aio --disable-ident-lookup --with-filedescriptors=65536
#make
#make install
可能需要创建一些文件 这些都是配置文件中需要调用的(这个要注意文件的属主和权限)
#cd /usr/local/squid/var/logs/
#touch cache.log
#chmod 755 cache.log
#chown squid:squid cache.log
#touch page_zs_access_log
#chmod 755 page_zs_access_log
#chown squid:squid page_zs_access_log
#cd /usr/local/squid/etc/
# > squid.conf
# vi squid.conf(211.**.**.**为服务器的ip地址)
visible_hostname www.abc.com
http_port 80 vhost vport
cache_mem 512 MB
maximum_object_size_in_memory 2048 KB
memory_replacement_policy lru
cache_dir ufs /tmp 512 16 256
max_open_disk_fds 0
minimum_object_size 0 KB
maximum_object_size 32768 KB
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
access_log /usr/local/squid/var/logs/page_zs_access_log combined
pid_filename /usr/local/squid/var/logs/squid.pid
cache_store_log none
cache_peer 211.**.**.** parent 81 0 no-query no-digest originserver name=www
cache_peer_domain www www.abc.com
cache_peer_access www allow all
http_access allow all
acl QUERY urlpath_regex cgi-bin .php .cgi .avi .wmv .rm .ram .mpg .mpeg .zip .exe
cache deny QUERY
cache_effective_user squid
cache_effective_group squid
#/usr/local/squid/sbin/squid -k parse
可以根据这个测试命令用来验证squid.conf的语法和配置(下面是OK的如果不OK会有相应的提示根据提示来修改配置文件)
2008/03/19 15:29:48| Processing Configuration File: /usr/local/squid/etc/squid.conf (depth 0)
#/usr/local/squid/sbin/squid -z
用来Creating Swap Directories
vi一个squid.sh的启动脚本如下:赋予可执行权限
#!/bin/sh
#
ulimit -HSn 15000
# this script starts and stops Squid
echo 15000 > /proc/sys/fs/file-max
case "$1" in
start)
/usr/local/squid/sbin/squid -s
echo -n ' Squid'
;;
stop)
/usr/local/squid/sbin/squid -k shutdown
;;
esac
#./squid.sh start就可以启动squid了(还有测试命令如:/usr/local/squid/sbin/squid -CNd1参考下)
查看有没有启动可以
#ps fax|grep squid
13750 pts/3 S+ 0:00 \_ grep squid
30474 ? Ss 0:00 /usr/local/squid/sbin/squid -s
30476 ? S 0:01 \_ (squid) -s
则证明OK
通过命令lsof -i:80查看谁占用了80端口
[root@www ~]# more /usr/local/squid/var/logs/page_zs_access_log |grep TCP_MEM_HIT
该指令可以看到在squid运行过程中,有那些文件被squid缓存到内存中,并返回给访问用户
219.147.203.146 - - [19/Mar/2008 14:48:54] "GET http://www.abc.com/images/ckt/chuank_11.gif HTTP/1.1" 200 1100 "http://www.abc.com/post.do?m=show&id=35558" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" TCP_MEM_HIT:NONE
[root@www ~]# more /usr/local/squid/var/logs/page_zs_access_log |grep TCP_HIT
该指令可以看到在squid运行过程中,有那些文件被squid缓存到cache目录中,并返回给访问用户
124.64.41.91 - - [19/Mar/2008 15:49:09] "GET http://www.abc.com/products/big/1647/0803/20080319020212_289.jpg HTTP/1.1" 200 65589 "http://www.abc.com/manager.production.do?p_cid=13" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" TCP_HIT:NONE
[root@www ~]# more /usr/local/squid/var/logs/page_zs_access_log |grep TCP_MISS
该指令可以看到在squid运行过程中,有那些文件没有被squid缓存,而是现重原始服务器获取并返回给访问用户
220.181.38.190 - - [17/Mar/2008:17:23:34 +0800] "GET http://www.abc.com/post.do?pcid=198 HTTP/1.1" 200 25162 "-" "Baiduspider+(+http://www.baidu.com/search/spider.htm)" TCP_MISS:DIRECT
可以查看下命中率及其他相关信息
#/usr/local/squid/bin/squidclient -p 80 -h localhost mgr:info
[root@www ~]# /usr/local/squid/bin/squidclient -p 80 -h localhost mgr:info
HTTP/1.0 200 OK
Server: squid/3.0.STABLE2
Mime-Version: 1.0
Date: Wed, 19 Mar 2008 07:37:22 GMT
Content-Type: text/plain
Expires: Wed, 19 Mar 2008 07:37:22 GMT
Last-Modified: Wed, 19 Mar 2008 07:37:22 GMT
X-Cache: MISS from www.abc.com
Via: 1.0 www.abc.com (squid/3.0.STABLE2)
Connection: close
Squid Object Cache: Version 3.0.STABLE2
Start Time: Wed, 19 Mar 2008 06:47:32 GMT
Current Time: Wed, 19 Mar 2008 07:37:22 GMT
Connection information for squid:
Number of clients accessing cache: 244
Number of HTTP requests received: 30303
Number of ICP messages received: 0
Number of ICP messages sent: 0
Number of queued ICP replies: 0
Number of HTCP messages received: 0
Number of HTCP messages sent: 0
Request failure ratio: 0.00
Average HTTP requests per minute since start: 608.2
Average ICP messages per minute since start: 0.0
Select loop called: 532175 times, 5.617 ms avg
Cache information for squid:
Hits as % of all requests: 5min: 90.3%, 60min: 75.5%
Hits as % of bytes sent: 5min: 31.8%, 60min: 45.4%
Memory hits as % of hit requests: 5min: 6.1%, 60min: 32.8%
Disk hits as % of hit requests: 5min: 0.0%, 60min: 0.1%
Storage Swap size: 35624 KB
Storage Swap capacity: 6.8% used, 93.2% free
Storage Mem size: 37232 KB
Storage Mem capacity: 7.1% used, 92.9% free
Mean Object Size: 21.38 KB
Requests given to unlinkd: 418
Median Service Times (seconds) 5 min 60 min:
HTTP Requests (All): 0.00000 0.00000
Cache Misses: 0.07409 0.00000
Cache Hits: 0.00000 0.00000
Near Hits: 0.00000 0.00000
Not-Modified Replies: 0.00000 0.00000
DNS Lookups: 0.00000 0.00000
ICP Queries: 0.00000 0.00000
Resource usage for squid:
UP Time: 2989.216 seconds
CPU Time: 1.396 seconds
CPU Usage: 0.05%
CPU Usage, 5 minute avg: 0.05%
CPU Usage, 60 minute avg: 0.05%
Process Data Segment Size via sbrk(): 8044 KB
Maximum Resident Size: 0 KB
Page faults with physical i/o: 1
Memory usage for squid via mallinfo():
Total space in arena: 8312 KB
Ordinary blocks: 8283 KB 19 blks
Small blocks: 0 KB 0 blks
Holding blocks: 48028 KB 306 blks
Free Small blocks: 0 KB
Free Ordinary blocks: 28 KB
Total in use: 56311 KB 100%
Total free: 28 KB 0%
Total size: 56340 KB
Memory accounted for:
Total accounted: 44495 KB 79%
memPool accounted: 44495 KB 79%
memPool unaccounted: 11844 KB 21%
memPoolAlloc calls: 5319189
memPoolFree calls: 5198329
File descriptor usage for squid:
Maximum number of file descriptors: 15000
Largest file desc currently in use: 61
Number of file desc currently in use: 37
Files queued for open: 0
Available number of file descriptors: 14963
Reserved number of file descriptors: 100
Store Disk files open: 0
Internal Data Structures:
3412 StoreEntries
3402 StoreEntries with MemObjects
3401 Hot Object Cache Items
1666 on-disk objects
[root@www ~]# /usr/local/squid/bin/squidclient -p 80 -h localhost mgr:info
HTTP/1.0 200 OK
Server: squid/3.0.STABLE2
Mime-Version: 1.0
Date: Wed, 19 Mar 2008 07:45:48 GMT
Content-Type: text/plain
Expires: Wed, 19 Mar 2008 07:45:48 GMT
Last-Modified: Wed, 19 Mar 2008 07:45:48 GMT
X-Cache: MISS from www.abc.com
Via: 1.0 www.abc.com (squid/3.0.STABLE2)
Connection: close
Squid Object Cache: Version 3.0.STABLE2
Start Time: Wed, 19 Mar 2008 06:47:32 GMT
Current Time: Wed, 19 Mar 2008 07:45:48 GMT
Connection information for squid:
Number of clients accessing cache: 173
Number of HTTP requests received: 36309
Number of ICP messages received: 0
Number of ICP messages sent: 0
Number of queued ICP replies: 0
Number of HTCP messages received: 0
Number of HTCP messages sent: 0
Request failure ratio: 0.00
Average HTTP requests per minute since start: 623.2
Average ICP messages per minute since start: 0.0
Select loop called: 633105 times, 5.522 ms avg
Cache information for squid:
Hits as % of all requests: 5min: 87.9%, 60min: 77.5%
Hits as % of bytes sent: 5min: 25.9%, 60min: 42.0%
Memory hits as % of hit requests: 5min: 7.8%, 60min: 27.8%
Disk hits as % of hit requests: 5min: 0.0%, 60min: 0.1%
Storage Swap size: 42468 KB
Storage Swap capacity: 8.1% used, 91.9% free
Storage Mem size: 45360 KB
Storage Mem capacity: 8.7% used, 91.3% free
Mean Object Size: 22.40 KB
Requests given to unlinkd: 513
Median Service Times (seconds) 5 min 60 min:
HTTP Requests (All): 0.00000 0.00000
Cache Misses: 0.08265 0.00091
Cache Hits: 0.00000 0.00000
Near Hits: 0.00000 0.00000
Not-Modified Replies: 0.00000 0.00000
DNS Lookups: 0.00000 0.00000
ICP Queries: 0.00000 0.00000
Resource usage for squid:
UP Time: 3496.007 seconds
CPU Time: 1.644 seconds
CPU Usage: 0.05%
CPU Usage, 5 minute avg: 0.06%
CPU Usage, 60 minute avg: 0.05%
Process Data Segment Size via sbrk(): 8580 KB
Maximum Resident Size: 0 KB
Page faults with physical i/o: 1
Memory usage for squid via mallinfo():
Total space in arena: 8848 KB
Ordinary blocks: 8828 KB 72 blks
Small blocks: 0 KB 0 blks
Holding blocks: 57000 KB 372 blks
Free Small blocks: 0 KB
Free Ordinary blocks: 19 KB
Total in use: 65828 KB 100%
Total free: 19 KB 0%
Total size: 65848 KB
Memory accounted for:
Total accounted: 53423 KB 81%
memPool accounted: 53423 KB 81%
memPool unaccounted: 12424 KB 19%
memPoolAlloc calls: 6293795
memPoolFree calls: 6157879
File descriptor usage for squid:
Maximum number of file descriptors: 15000
Largest file desc currently in use: 155
Number of file desc currently in use: 149
Files queued for open: 0
Available number of file descriptors: 14851
Reserved number of file descriptors: 100
Store Disk files open: 22
Internal Data Structures:
3730 StoreEntries
3720 StoreEntries with MemObjects
3686 Hot Object Cache Items
1896 on-disk objects
发表评论
-
iptables封讯雷
2010-07-05 16:06 2336本文转自网络 下载文件最新内核: http://www. ... -
温顾而知新--gcc和vi基本用法
2010-04-15 14:35 1009vi编辑器是所有Unix及Li ... -
yum php 5.1 更新 5.2
2009-06-09 14:04 1182rpm --import http://www.jason ... -
Linux系统管理硬件配置
2009-05-12 15:45 1237常用命令整理如下:查 ... -
nagios二 客户端程序的安装
2009-01-12 18:46 2614要监视客户机的本地信息需要用到nrpe这个程序 NRPE的原理 ... -
nagios监控一(主程序的安装)
2009-01-12 18:45 1688Nagios 是一个开放源代码的主机、服务和网络监控平台,有各 ... -
lighttpd的启动脚本
2009-01-12 18:43 3432参考http://trac.lighttpd.net/tra ... -
lighttpd+tomcat+squid3.0
2009-01-12 18:41 1779我这里主要是用lighttpd来代替已有的apach ... -
Linux Iptables语法
2009-01-12 18:37 1133语法 1. 对链的操作 建 ... -
nmap使用详解
2009-01-12 18:35 1021nmap使用详解 nm ... -
网络监控工具:IPTraf
2009-01-12 18:30 40212.使用IPTraf 2.1 ... -
优化squid配置
2009-01-12 18:29 1179#设置运行时的用户和组权限 cache_effective_u ... -
squid 基本配置
2009-01-12 18:27 1264配置命令configure有很多选项,如果不清楚可先用“-he ... -
linux 内核升级
2009-01-12 15:44 2018一 准备工作1 查看linux内核版本#uname -a2 下 ... -
lvs DR模式
2009-01-12 15:43 1918集群技术主要分为三大类: 高可用性(High Availa ... -
sarg对squid的日志流量分析报表(按小时,天,周生成)
2009-01-12 15:41 34401.SARG介绍 SARG的全称是:Squid Analys ... -
Linux下Java的安装及环境配置
2009-01-12 15:40 1743在sun官网下载JDK 6(jdk-6u7-linux-i5 ... -
linux集群
2009-01-12 15:33 1182集群系统主要就2种: 系统:Centos5.0 集群软件: ...
相关推荐
**Squid 3.0 for Windows:网络缓存代理详解** Squid是一个开源的高性能HTTP/FTP代理服务器和缓存系统,广泛应用于互联网环境,以提高网站访问速度、减轻服务器负载。Squid 3.0是该软件的一个重要版本,针对Windows...
总之,Squid 3.0是一个强大而灵活的网络代理,通过深入理解并配置其各项选项,用户可以定制一个满足特定需求的高效网络解决方案。配置手册是掌握Squid操作的关键资源,它将引导用户逐步了解和掌握这款工具的使用。
这个" Squid3.0稳定版(经个人测试) " 提供的是一个经过验证的、可靠的Squid 3.0 STABLE24版本。这个版本在发布时被认为是最稳定的,适合用于生产环境。 Squid 的主要功能包括: 1. **内容缓存**:Squid 可以缓存...
安装篇: 本教程应用环境为干净centos 5.5 ,预先分好并加载/data分区,并且关闭selinux及iptables 首先修改文件描述符并设定临时端口范围,这些设置重启后生效 代码如下: cat >> /etc/security/limits.conf <...
单网卡Squid 3.0配置作为内网透明代理是一种常见的网络管理策略,主要用于监控和控制内部网络用户的互联网访问行为。在本文中,我们将详细介绍如何在CentOS 5.5系统上使用Squid 3.0和iptables实现这一功能。 首先,...
本文将详细讲解如何使用Squid进行反向代理配置,通过提供的文件名,我们可以看到有四种不同的配置场景:单站点代理、多站点代理、以及两种实现Web站点负载均衡的方法(sibling形式和常规方式)。 1. **单站点代理**...
Squid反向代理服务器是实现反向代理的常用方法之一。它可以缓存静态的网页和图片,降低WEB服务器的负载,提高访问速度。 Squid反向代理服务器可以配置为 Cache hierarchy,以便快速地提供 WEB 内容。 Squid反向代理...
### Squid 反向代理配置详解 #### 一、实验背景及目标 本文档旨在详细介绍如何在特定环境下配置Squid作为反向代理服务器。实验环境包括一台运行Red Hat Enterprise Linux 5.5 (RHEL5.5)的虚拟机以及另一台运行...
Squid是一个流行的开源代理服务器和缓存系统,广泛用于互联网内容缓存和加速,以及企业网络中的流量管理和控制。这个压缩包包含的是Squid 3.0.STABLE25版本的源代码,这意味着你需要通过编译来安装它,以便在你的...
通过深入阅读并理解"Squid3.0反向代理的文档.doc",你可以获得构建和管理Squid CDN系统的宝贵知识,并进一步了解CDN技术如何在实际应用中提高网络性能和稳定性。此外,掌握Squid的使用对于网络管理员、系统架构师和...
Squid实现反向代理并且具备内网代理 Squid是一款功能强大且广泛使用的开源反向代理服务器软件,可以实现缓存、过滤、加速和安全等功能。下面是使用Squid实现反向代理并且具备内网代理的知识点总结: 一、Squid的...
本文档详细介绍了如何使用Squid作为反向代理并设置为内网代理,以优化网站性能。 首先,为了安装Squid,通常会通过Ports Collection来简化流程。在FreeBSD系统中,可以进入Ports目录,然后设置安装路径,接着编译并...
有需要的可以学习,可以给您的网站做反向代理加速。
【LVS + Squid 构建HA反向代理方案】是一种高效的高可用性集群解决方案,旨在提高Web服务的性能和稳定性。LVS(Linux Virtual Server)由章文嵩博士领导开发,是一个开源项目,旨在创建高并发、高性能、高可用的网络...
Squid缓存代理服务器的安装与配置(普通代理 透明代理 反向代理) Squid缓存代理服务器是一种流行的代理服务器和Web缓存服务器软件,广泛应用于提高Web服务器速度、缓存万维网、域名系统和其他网络搜索、帮助网络...
### Centos中Squid代理服务器安装与基本配置(含反向代理) #### 一、Squid代理服务器概述 Squid是一个广泛使用的代理缓存服务器,它能够为用户提供透明或非透明的代理服务,同时也支持反向代理功能。在教育环境中...
下载反向代理服务器软件采用squid,下载地址: http://www.squid-cache.org/Versions/v2/2.2/squid-2.2.STABLE5-src.tar.gz 下载后存放在/usr/local/squid/src目录里,文件名是 squid-2.2.STABLE5 ...
Linux运维-6.集群-集群视频-5、Squid缓存、代理服务-20、Squid 反向代理、ACL访问控