Linux OPS-CDN Deployment

Source: Internet
Author: User
Tags website server

Introduction to CDN

CDN (Content Delivery Network)

Content distribution network: All clients can get the closest resources from their own


DNS split parsing feature

Resolve the same host name to a different IP address, depending on the client source address

202.16.0.20

Dns

Http://www.163.com

PC1 192.168.1.1 3.3.3.9



PC2 192.168.1.2 192.168.1.100


DNS 202.106.0.20 (separation resolution)

Http://www.tarena.com


Www.tarena.com. In CNAME squid1.lxcdn.net

Lxcdn.net DNS


IP Address DNS Server


DNS for network segment DNS home internet

Unicom 202.16.0.20 Heilongjiang

Move

Telecom

Railcom





Project: CDN Cache Acceleration


Stencil machine configuration:

Configure the Yum source (Install the Developer Package Group GCC gcc-c++)

Turn off iptables disable SELinux

Nic mode only host run Level 3 memory 300 HDD 10G



-----------------------------------------------------------------


Http://www.tarena.com


172.16.0.10 website Server (Nginx)

172.16.0.20 website Server (Nginx)


172.16.0.100 Beijing Area CDN Cache Server (Squid)

172.16.0.200 Guangzhou CDN Cache Server (Squid)


172.16.0.11 Beijing Regional DNS server

172.16.0.22 Guangzhou Regional DNS server


172.16.0.111 impersonate an authoritative DNS server (manage all zones)


DNS Server for 172.16.0.222 CDN service providers


172.16.0.1 Beijing Area Client

172.16.0.2 Guangzhou Area Client


-------------------------------------------------------------

1 Configuring 2 Nginx Web servers

Yum-y Install Pcre-devel Openssl-devel

Useradd-s/sbin/nologin-m Nginx



/configure--prefix=/usr/local/nginx--user=nginx--group=nginx--with-http_ssl_module

Make

Make install


echo "172.16.0.10" >/usr/local/nginx/html/test.html


14/usr/local/nginx/sbin/nginx-t

15/usr/local/nginx/sbin/nginx

ELinks--dump http://localhost/test.html


2 Configuring 2 CDN Node Servers (squid)

Yum-y Install Squid


Vim/etc/squid/squid.conf

#http_access Deny All

Http_access Allow all

Http_port Vhost

Cache_peer 172.16.0.10 Parent 0 Originserver

Cache_peer 172.16.0.20 Parent 0 Originserver

Cache_dir UFS/VAR/SPOOL/SQUID 100 16 256

: Wq


Service squid start; Chkconfig squid on


3 Configuring DNS servers in the Beijing region (172.16.0.11)

Yum-y Install bind Bind-chroot

Mv/etc/named.conf/etc/named.conf.bak

Vim/etc/named.conf

Options {

Forwarders {172.16.0.111; };

};


Service named start; Chkconfig named on


4 Configuring DNS servers in the Guangzhou area (172.16.0.22)

Yum-y Install bind Bind-chroot

Mv/etc/named.conf/etc/named.conf.bak

Vim/etc/named.conf

Options {

Forwarders {172.16.0.111; };

};


Service named start; Chkconfig named on


5 Configuring the authoritative server (172.16.0.111)

Yum-y Install bind Bind-chroot


Edit Master profile/etc/named.conf define administrative area

Mv/etc/named.conf/etc/named.conf.bak


Vim/etc/named.conf

Options {

Directory "/var/named/"; //Zone data file storage path

Recursion No;

};


Zone "Tarena.com" {

Type master;

File "Tarena.com.zone";

};


Zone "Xinnet.com" {

Type master;

File "Xinnet.com.zone";

};


Zone "NET" {

Type master;

File "Net.zone";

};


: Wq



Edit Zone File

Vim/var/named/xinnet.com.zone

$TTL 3600

@in SOA @ root (

2015120600

28800

14400

17200

86400

)

@in NS dns111.xinnet.com.

Dns111.xinnet.com. In A 172.16.0.111;

: Wq


Vim/var/named/tarena.com.zone

$TTL 3600

@ in SOA @ root (

2015120600

28800

14400

17200

86400

)

@ in NS dns111.xinnet.com.

www in CNAME www.tarena.com.lxcdn.net.

: Wq


Vim/var/named/net.zone

$TTL 3600

@ in SOA @ root (

2015120600

28800

14400

17200

86400

)

@ in NS dns111.xinnet.com.

Lxcdn.net. in NS dns222.lxcdn.net.

Dns222.lxcdn.net. In A 172.16.0.222

: Wq


Service named start

----------------------------------------------------------------

6 Configuring the CDN Service DNS server (172.16.0.222)

Yum-y Install bind Bind-chroot

Mv/etc/named.conf/etc/named.conf.bak


Vim/etc/named.conf

Options {

Directory "/var/named";

};


ACL "Bjclient" {172.16.0.1; 172.16.0.11;    }; //define ACL point to test client host PC01 DNS point to 11

ACL "Gzclient" {172.16.0.2; 172.16.0.22;     }; //define ACL point to test client host PC02 DNS point to


View "Bjzone" {////define views zone1

match-clients {bjclient;        }; The //Match condition is the ACL for the specified PC01

Zone "Tarena.com.lxcdn.net" {

Type master;

File "Tarena.com.lxcdn.net.bjzone";

};

Zone "Lxcdn.net" {

Type master;

File "Lxcdn.net.zone";

};

};


View "Gzzone" {

match-clients {gzclient; };

Zone "Tarena.com.lxcdn.net" {

Type master;

File "Tarena.com.lxcdn.net.gzzone";

};

Zone "Lxcdn.net" {

Type master;

File "Lxcdn.net.zone";

};

};

: Wq


Vim/var/named/tarena.com.lxcdn.net.bjzone

$TTL 3600

@ in SOA @ root (

2015120600

28800

14400

17200

86400

)

@ in NS dns222.lxcdn.net.

dns222 in A 172.16.0.222

www in A 172.16.0.100

: Wq




Vim/var/named/tarena.com.lxcdn.net.gzzone

$TTL 3600

@ in SOA @ root (

2015120600

28800

14400

17200

86400

)

@ in NS dns222.lxcdn.net.

dns222 in A 172.16.0.222

www in A 172.16.0.200

: Wq


Vim/var/named/lxcdn.net.zone

$TTL 3600

@ in SOA @ root (

2015120600

28800

14400

17200

86400

)

@ in NS dns222.lxcdn.net.

In A 172.16.0.222

dns222 in A 172.16.0.222

squid100in A 172.16.0.100

squid200in A 172.16.0.200

: Wq


Service named Start;chkconfig named on


---------------------------------------------------------------

Client Test 172.16.0.1/2


Vim/etc/resolv.conf

NameServer the IP address of the DNS server in your own region

: Wq

Host Www.tarena.com

------------------------------------------------------------


172.16.0.111

Host name registered on the new network www.tarena.com


Blue News Company provides 2 servers to do cache server

172.16.0.100

172.16.0.200

Corresponding host name Www.tarena.com.lxcdn.net


Blue CyberLink DNS server 172.16.0.222 provides host name resolution services in the Lxcdn.net region.


Internet Client Access http://www.tarena.com










Linux OPS-CDN Deployment

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.