Using Squid reverse proxy to build CDN cache server to speed up Web Access

Source: Internet
Author: User

November 26, 2011? Web server architecture? Number of reviews 2


web server: Domain name www.abc.com ip:192.168.21.129 Telecom Single line access
Access users: Telecom broadband users, Mobile broadband users
solution: Place a CDN proxy server in the mobile room, Through intelligent DNS resolution, let telecom users access the Web server directly, let mobile users access the CDN Proxy server, solve the problem of mobile users ' slow access to the Web server
What to do:
CDN Proxy Server:
system: CentOS 5.5 host Name: cdn.abc.com ip:192.168.21.160 install squid software, Configure the reverse proxy to build a CDN cache server
prepare before installation:
   vi/etc/selinux/config
   #SELINUX = enforcing     #注释掉
   #SELINUXTYPE =targeted  #注释掉
   selinux= disabled  #增加
  :wq  Save, close.
   Shutdown-r Now restart the system


2, open the firewall 80 port (after configuring Squid port is 80)
Vi/etc/sysconfig/iptables
Add the following content
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
/etc/init.d/iptables Restart #重启防火墙使配置生效


3, modify the host's routing mode
Vi/etc/sysctl.conf
Net.ipv4.ip_forward = 1 #0为关闭, 1 for open routing use sysctl-p command to view
system operation and maintenance www.osyunwei.com Warm reminder: qihang01 original content? Copyright, reproduced Please indicate the source and the original link
4, modify the host hosts file, increase the domain name resolution record
Vi/etc/hosts
192.168.21.129 www.abc.com #添加解析记录


===========================================================================
Installation start
1. Install Squid
Yum Install squid #安装 (squid 2.6)
Service Squid start #启动
Service Squid Restart #重启
Chkconfig squid on #设置开机启动


2. Configure Squid
Cp/etc/squid/squid.conf/etc/squid/squid.confbak #备份
Vi/etc/squid/squid.conf #编辑文件

Http_port Transparent #设置squid端口, the default is 3128, set to 80, the client does not need to enter the port number when opening the site
Cache_mem MB #分配内存大小
Cache_dir ufs/var/spool/squid 4096 #设置缓存文件大小
Cache_effective_user Squid #设置用户
Cache_effective_group Squid #设置用户组
Access_log/var/log/squid/access.log #设置访问日志文件
Cache_log/var/log/squid/cache.log #设置缓存日志文件
Cache_store_log/var/log/squid/store.log #设置缓存记录文件
Visible_hostname cdn.abc.com #设置squid服务器主机名
cache_mgr [email protected] #设置管理员邮箱 (set to your own email address)
ACL all src 0.0.0.0/0.0.0.0 #设置访问控制列表, enabled by default
Http_access Allow all #设置访问权限, commented out by default
Cache_peer 192.168.21.129 Parent 0 no-query originserver name=web #用户访问web时, Squid sends requests to 192.168.21.129 's 80 port
Cache_peer_domain Web www.abc.com #设置web域名为www. abc.com
Cache_peer_access Web Allow all #设置访问权限, allowing all external clients to access the Web

: wq! #保存退出
Service Squid Stop #停止
/usr/sbin/squid-z #初始化cache缓存目录
Service Squid start #启动
System operation and maintenance www.osyunwei.com warm reminder: qihang01 original content? Copyright, reproduced Please indicate the source and the original link
Squid Reverse proxy Server installation configuration complete
==================================================================
enable smart DNS resolution:
If a telco user accesses the domain name www.abc.com resolves to 192.168.21.128
If a mobile user accesses the domain name www.abc.com resolves to 192.168.21.160
A leased line connection between the CDN cache server and the Web server

Transferred from: http://zhumeng8337797.blog.163.com/blog/static/10076891420121119150163/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.