当前位置: 首页 > 图文教程 > 操作系统 > Unix/Linux > Squid实现反向代理并且具备内网代理

Unix/Linux
REDHAT企业版LINUX5.0安装过程图解教程
Linux系统下安装phpmyadmin方法
RedHat Enterprise Linux 5下配置Apache+Mysql+Php
Linux和Windows双系统Grub丢失恢复
Linux系统下touch命令的使用方法
linux下面建立GPRS无线MODEM拨号的方法
redhat linux AS4 下配置无线网卡
让Linux操作系统开机默认进入文本模式
Linux文件权限的设置方法与技巧
linux chown与chmod命令的区别
Linux关机命令详细说明
linux系统 加载u盘、光盘、软盘方法
Linux系统下防止 ARP 欺骗_绑定IP地址和MAC地址
Linux系统中Mysql的安装备份与密码恢复
Linux系统下添加新硬盘,分区,格式化相关步骤
Linux系统下编译安装支持NTFS的内核模块
调整Linux磁盘分区的大小的方法
正确关闭Linux计算机的命令和方法
查看Linux系统下Raid信息
Linux下单网卡绑定多IP与多网卡共用单IP 的方法

Unix/Linux 中的 Squid实现反向代理并且具备内网代理


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-01   浏览: 103 ::
收藏到网摘: n/a

我的站点上的所有文件都是静态html,为了进一步的加快网页速度,于是使用squid实现反向代理缓存功能。

@ 安装squid

为了偷懒就直接使用ports安装,因为我将所有的服务器系统都安装在/s分区中,所以设置了PREFIX为/s/squid

# cd /usr/ports/www/squid

# setenv PREFIX /s/squid

# make install clean

安装完成后编辑/s/squid/etc/squid/squid.conf,我的配置内容如下:

########## Base control ##########

cache_mgr webmaster

cache_effective_user squid

cache_effective_group squid

visible_hostname sleepcat.3322.org

http_port 127.0.0.1:3128

icp_port 0

cache_dir ufs /usr/cache 300 16 256

cache_access_log /dev/null

cache_log /dev/null

cache_store_log /dev/null

error_directory /s/squid/etc/squid/errors/Simplify_Chinese

icon_directory /s/squid/etc/squid/icons

mime_table /s/squid/etc/squid/mime.conf

coredump_dir /s/squid/squid/cache

pid_filename /s/squid/squid/logs/squid.pid

hosts_file /etc/hosts

unlinkd_program /s/squid/libexec/squid/unlinkd

########## Performance control ##########

cache_mem 8 MB

cache_swap_low 90

cache_swap_high 95

maximum_object_size 4096 KB

minimum_object_size 0 KB

maximum_object_size_in_memory 8 KB

ipcache_size 1024

ipcache_low 90

ipcache_high 95

fqdncache_size 1024

cache_replacement_policy lru

memory_replacement_policy lru

emulate_httpd_log off

log_ip_on_direct on

log_mime_hdrs off

dns_timeout 2 minutes

request_header_max_size 10 KB

request_body_max_size 0 KB

refresh_pattern ^ftp: 1440 20% 10080

refresh_pattern ^gopher: 1440 0% 1440

refresh_pattern . 0 20% 4320

negative_ttl 5 minutes

positive_dns_ttl 6 hours

negative_dns_ttl 1 minute

connect_timeout 1 minute

read_timeout 15 minutes

request_timeout 5 minutes

client_lifetime 1 day

half_closed_clients on

maximum_single_addr_tries 1

uri_whitespace strip

ie_refresh off

[1] [2] 下一页