System version: CentOS 6.6 32-bit
1, installation Squid:yum install Squid-y
2. Configuration file:
Cache_effective_user Squid #用户
Cache_effective_group Squid #组
Http_port 121.42.40.26:80 Accel Vhost #设置启动端口 accel for acceleration mode, vhost to forward requests
Dns_nameservers 8.8.8.8 #DNS服务器设置
Visible_hostname localhost #服务器名 for error page display
cache_mgr [email protected] #管理员邮箱 for error page display
Cache_mem MB #内存缓存大小
Maximum_object_size 4 MB #单文件最大缓存
Cache_dir ufs/var/cache/squid 4096 16 256 # Cache directory size is 4g,16 2 levels, each 2-level directory has 256 subdirectories
Cache_swap_high #控制缓存大小, over 90% clean up
Cache_swap_low #到80% Stop
Logfile_rotate 7 #日志保留七天, with Crontab
Cache_access_log/var/log/squid/access.log #访问日志
Cache_log/var/log/squid/cache.log #缓存日志, the boot information can be seen here.
Cache_store_log/var/log/squid/store.log #网页缓存日志
Cache_peer 121.42.40.26 Parent Bayi 0 originserver name=www #这里把后端web服务器设置为81端口了 alias www
Cache_peer_domain www www.squid.com #实现代理这个web服务器, can proxy multiple servers
Cache_peer_access www. All #允许所有人访问
3. Initialization: Squid-z
4. Starting Squid:/etc/init.d/squid Start
5, 0 3 * * * */usr/sbin/squid-k rotate crontab Add a sentence this, every night three o'clock log cutting
6, to test their own squid is effective
Beginner's Squid Reverse proxy