在FreeBSD下安装软件最方便的方法是使用ports。本文为了让大家对通用的软件安装方法做一定的了解,我们采用通用的方法来安装Squid,也就是说,下面的方法同样适用于Linux或其他Unix版本。
在ylf的用户目录下创建目录app用来存放程序安装临时文件:
将用户ylf设为/home/ylf/app目录及其子目录的所有者
| # chown –R ylf /home/ylf/app |
到 http://www.squid-cache.org/Versions/v2/2.5/ 下载Squid 的最新稳定版本,现在是squid-2.5.STABLE3
打开IE浏览器,在地址栏输入ftp://192.168.0.1 ,出现ftp登陆对话框,输入用户名ylf及密码,登录成功后。将下载的squid-2.5.STABLE3复制到app目录中。
执行如下命令:
# cd /home/ylf/app # tar zxvf squid-2.5.STABLE3.tar.gz #解压缩安装包 # cd squid-2.5.STABLE3 #进入解开的目录 # ./configure --prefix=/usr/local/squid #配制、将squid安装在/usr/local/squid目录 # make all #编译 # make install #安装 |
下面编辑Squid的配置文件:
| # cd /usr/local/squid/etc |
将原来的配置文件改名:
| # mv squid.conf squid.conf.bak |
编辑新的配置文件:
我的squid.conf内容如下:
#取消对代理阵列的支持 icp_port 0
#对日志文件和pid文件位置进行设置 cache_store_log none cache_access_log /usr/local/squid/var/logs/access.log cache_log /usr/local/squid/var/logs/cache.log emulate_httpd_log on pid_filename /usr/local/squid/var/logs/squid.pid
#设置运行时的用户和组权限 cache_effective_user squid cache_effective_group squid
#设置管理信息 visible_hostname wwwx.3322.org. cache_mgr yourname@yourdomain.com
#设置监听地址和端口 http_port 3128 udp_incoming_address 0.0.0.0
#设置squid用户hot object的物理内存的大小以及设置cache目录 cache_mem 32 MB cache_dir ufs /usr/local/squid/cache 1024 16 256
#访问控制设置 acl mynet src 192.168.0.0/255.255.255.0 acl all src 0.0.0.0/0.0.0.0 http_access allow mynet http_access deny all
#透明代理设置 httpd_accel_host virtual httpd_accel_port 80 httpd_accel_with_proxy on httpd_accel_uses_host_header on
#swap 性能微调 half_closed_clients off cache_swap_high 100% cache_swap_low 80% maximum_object_size 1024 KB
#控制对象的超时时间 refresh_pattern -i .html 1440 90% 129600 reload-into-ims refresh_pattern -i .shtml 1440 90% 129600 reload-into-ims refresh_pattern -i .hml 1440 90% 129600 reload-into-ims refresh_pattern -i .gif 1440 90% 129600 reload-into-ims refresh_pattern -i .swf 1440 90% 129600 reload-into-ims refresh_pattern -i .jpg 1440 90% 129600 reload-into-ims refresh_pattern -i .png 1440 90% 129600 reload-into-ims refresh_pattern -i .bmp 1440 90% 129600 reload-into-ims refresh_pattern -i .js 1440 90% 129600 reload-into-ims |
需要改的地方是访问控制设置中的子网改成你自己的子网。其他的地方可根据需要调整。不改也可。
如果不使用日志,将日志设置部分改成如下句子:
cache_store_log none cache_access_log /dev/null cache_log /dev/null |
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有