Squid reverse proxy CDN build configuration
Because of the company's business needs, you need to build a cdn node somewhere by yourself. You can build a node by using DNSpod smart resolution and squid.
Installation path:/usr/local/squid
1. Install squid
Download http://www.squid-cache.org/Versions/v3/3.4/squid-3.4.8.tar.gz
# Yum-y install gcc-c ++ # install the compilation plug-in
# Tar xvf squid-3.4.8.tar.gz
# Cd squid-3.4.8
# Cd/usr/local
# Mkdir squid # create a directory named squid
# Cd squid-3.4.8
#./Configure -- prefix =/usr/local/squid # compile
# Make & make install # install
Configuration 1
Create user squid and user group squid
# Groupadd squid
# Useradd-g squid-s/sbin // nologin squid
Configure the squid File
# Vi/usr/local/squid/etc/squid. conf # view the content at the bottom
Visible_hostname chengdu.sz1card1.com
Cache_inclutive_user squid
Cache_paitive_group squid
Http_port 80 accel vhost vport
Cache_peer 192.168.1.11 parent 80 0 no-query originserver round-robin name = proxy1
Cache_peer 192.168.1.12 parent 80 0 no-query originserver round-robin name = proxy2
Cache_peer 192.168.1.13 parent 80 0 no-query originserver round-robin name = proxy3
Cache_peer_domain proxy1 server.1card1.cn
Cache_peer_domain proxy2 www.abc.cn
Cache_peer_domain proxy2 www.xxxx.cn
Cache_peer_domain proxy3 www.bkjia.com
Http_access allow all
Cache_log/usr/local/squid/var/logs/cache. log
Access_log/usr/local/squid/var/logs/access. log squid
Cache_dir ufs/usr/local/squid/var/cache 1000 16 256
Maximum_object_size 10240 KB
Maximum_object_size_in_memory 1024 KB
Cache_mem 1024 MB
Configuration 2
# Chown-Rf squid: nobody/usr/local/squid
Initialize the cache directory configured in squid. conf to create a bunch of directories:
# Sudo/usr/local/squid/sbin/squid-z
Start squid background running
Sudo/usr/local/squid/sbin/squid-s
Check whether the process exists: ps-ef | grep squid
Common commands for routine maintenance of Squid:
1. initialize the cache directory you configured in squid. conf.
Squid-z
If an error message is displayed, check the permission of your cache directory.
You can use the following command to change the directory permissions:
Chown-R squid: squid/cache directory
2. Check the syntax and configuration of squid. conf.
Squid-k parse
If squid. conf has syntax or configuration errors, a prompt is returned. If no result is returned, start squid.
3. Start squid on the frontend and output the startup process.
/Usr/local/squid/sbin/squid-N-d1
If you have ready to server reques information, it indicates that Squid is successfully started.
Squid as the system service restart script
#! /Bin/bash #
Chkconfig: 345 61 61
# Description: squid is a web cache server
# Processname: squid
./Etc/rc. d/init. d/functions
Case $1 in
"Start")/usr/local/squid/sbin/squid-s
If [$? = "0"]; then
Echo "squid start OK"
Else
Echo "please check the log"
Fi
;;
"Stop")/usr/local/squid/sbin/squid-k shutdown
If [$? = "0"]; then
Echo "squid stop OK"
Else
Echo "please check the log"
Fi
;;
"Restart ")
/Usr/local/squid/sbin/squid-k shutdown
If [$? = "0"]; then
/Usr/local/squid/sbin/squid-s
If [$? = "0"]; then
Echo "squid restart OK"
Else
/Usr/local/squid/sbin/squid-s
If [$? = "0"]; then
Echo "squid restart OK"
Else
Echo "please check the log"
Fi
Fi
Fi
;;
*)
Echo "Usage only start | stop | restart"
;;
Esac
Put this file in the/etc/init. d/directory and name it squid.
Chmod + x/etc/init. d/squid
Chkconfig -- add squid
If the squid service does not support chkconfig
Then modify the preceding chkconfig: 345 61 61 numbers.
Configure Squid proxy http and rsync
Squid: high-speed Web Access
CentOS 6.2 compilation and installation Squid configuration Reverse Proxy Server
Simple configuration of Squid proxy and reverse proxy
Build high-availability Web servers using DNS + Squid + Nginx + MySQL in CentOS 6.4
Squid details: click here
Squid: click here
This article permanently updates the link address: