RHEL / CentOS: Youtube Video Cache With Squid and Nginx
On this occasion, we will discuss the process of installing Youtube Video Cache with Squid and Nginx on
Install the packages needed in the squid installation process:
RHEL / CentOS
where in previous writings more often used Ubuntu server in terms of creating a proxy server, but this time we will use OS Linux RHEL / CentOS 6
where to further explore our knowledge (I am personally) in terms of Linux networking: D. However, if you are still using the proxy world (ubuntu server), maybe this is one alternative in making proxy servers on RPM-based machines.Install the packages needed in the squid installation process:
1 2 3 4 5 6 7 8 | # yum install patch gcc make ccze ruby # cd /root # wget -c http://www.squid-cache.org/Versions/v2/2.7/squid-2.7.STABLE9.tar.gz # tar -xvzf squid-2.7.STABLE9.tar.gz # cd squid-2.7.STABLE9/src/ # wget http://youtube-cache.googlecode.com/files/patch-youtube # patch -p0 client_side.c < patch-youtube # cd ../ |
Configure Squid with the following parameters:
1 2 3 4 5 6 7 8 9 10 | ./configure --prefix=/usr --exec_prefix=/usr --bindir=/usr/sbin --sbindir=/usr/sbin --libexecdir=/usr/lib/squid --sysconfdir=/etc/squid --localstatedir=/var/spool/squid --datadir=/usr/share/squid --enable-async-io=24 --with-aufs-threads=24 --with-pthreads --enable-storeio=aufs --enable-linux-netfilter --enable-arp-acl --enable-epoll --enable-removal-policies=heap --with-aio --with-dl --enable-snmp --enable-delay-pools --enable-htcp --enable-cache-digests --disable-unlinkd --enable-large-cache-files --with-large-files --enable-err-languages=English --enable-default-err-language=English --with-maxfd=65536 |
Add and unlock Squid user password:
1 2 | # useradd squid # passwd -fu squid |
Add the epel repository to install nginx:
1 2 3 4 | # cd /root # wget -c http://mirror.smartmedia.net.id/epel/6Server/x86_64/ epel-release-6-8.noarch.rpm # rpm -ivh epel-release-6-8.noarch.rpm |
The installation and backup process for squid.conf and nginx.conf configurations:
1 2 3 | # yum install nginx # mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.backup # mv /etc/squid/squid.conf /etc/squid/squid.conf.backup |
Download examples of squid.conf and nginx.conf configurations from
techsoftcenter
google code:1 2 3 4 | # cd /etc # wget -c http://techsoftcenter .googlecode.com/files/techsoftcenter -squid%2Bnginx-video-cache.tar.gz # tar -xvzf techsoftcenter -squid+nginx-video-cache.tar.gz |
Set ownership of folder/cache access, build squid folder, disable
iptables
and set so that Squid can run when the system is turned on:1 2 3 4 | # chown squid.squid /cache # squid -z # iptables -F && service iptables save # vi /etc/rc.d/rc.local |
add the following configuration rc.local:
1 | /usr/sbin/squid -NDd1 & |
Disable
SELinux
:1 | # vi /etc/selinux/config |
set disable selinux
1 | SELINUX=disabled |
Run the
nginx
service and set the folder parameters that nginx has:Restart your proxy machine
1 2 3 | # reboot -fn # tail -f /var/log/squid/access.log | ccze # tail -f /var/log/nginx/access.log | ccze |