虚拟化容器,大数据,DBA,中间件,监控。

Squid反向代理多tomcat配置

20 01月
作者:admin|分类:系统运维

Squid反向代理多tomcat配置  


参考
http://wanglq.blog.51cto.com/783560/393257
http://hi.baidu.com/rjqtfuqdcpbnouq/item/b6e4ef071340a513addc70a9
http://smtlwt.blog.51cto.com/6017573/1170410

安装:
# yum install squid -y

配置文件:
/etc/squid/squid.conf

命令
验证 squid.conf 的 语法和配置。
# squid -k parse

在前台启动squid,并输出启动过程。
#squid -N -d1

启动squid在后台运行。
#squid -s

停止 squid
#squid -k shutdown

重引导修改过的 squid.conf
#squid -k reconfigure

轮循日志 
squid -k rotate 

把squid添加到系统启动项
编辑 /etc/rc.d/rc.local
添加:/usr/sbin/squid -s

示例:

http_port 83 accel vhost vport hierarchy_stoplist cgi-bin ? acl apache rep_header Server ^Apache #broken_vary_encoding allow apache cache_mem 2048 MB maximum_object_size_in_memory 2048 KB cache_dir ufs /opt/cache 5120 128 128 strip_query_terms off logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh acl nolog urlpath_regex \.gif \.jpg \.css \.js \.swf \.png \.ico \.GIF \.JPG \.CSS \.JS \.SWF \.PNG \.ICO access_log /var/log/squid/access.log combined !nolog cache_log /var/log/squid/cache.log cache_store_log none hosts_file /etc/hosts url_rewrite_children 200 refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern ^http: 30 50% 60 refresh_pattern . 0 20% 60 connect_timeout 2 minute peer_connect_timeout 120 seconds #acl 0.0.0.0/0.0.0.0 #acl manager proto cache_object #acl localhost src 127.0.0.1/255.255.255.255 #acl to_localhost dst 127.0.0.0/8 acl SSL_ports port 443 acl CONNECT method CONNECT #acl monitor12530 src 10.25.136.105/255.255.255.255 #acl mall-admin url_regex -i ^http://mall\.mydomain\.cn\/admin #acl mclub-admin url_regex -i ^http://mclub\.mydomain\.cn\/admin #http_access allow manager monitor12530 #http_access deny manager #http_access deny mall-admin #http_access deny mclub-admin #http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow all icp_access allow all follow_x_forwarded_for allow all #cache_mgr redcloud_tech_op@redcloud.mobi cache_effective_user squid cache_effective_group squid visible_hostname web4.mydomain.cn #snmp_port 3401 #acl snmppublic snmp_community xxxxxxxxxx #snmp_access allow snmppublic localhost snmp_access deny all coredump_dir /usr/local/squid/var/cache cache_peer 192.168.3.103 parent 8080 0 no-query originserver name=www1 round-robin cache_peer 192.168.3.106 parent 8080 0 no-query originserver name=www2 round-robin cache_peer_domain www1 cache_peer_domain www2 cache_peer_access www1 allow all cache_peer_access www2 allow all # rul 重写规则 #url_rewrite_children 200 # #acl rewriteurl url_regex -i ^http://mclub\.mydomain\.cn\/rts #acl rewriteurl url_regex -i ^http://mydomain\.cn # #url_rewrite_access allow rewriteurl



浏览2192 评论0
返回
目录
返回
首页
结合Apache和Tomcat实现集群和负载均衡 简单的Nginx+Squid+Tomcat架构