Install and Setup Squid as HTTP web proxy, squid caching and forwarding to speeding up a web server by caching repeated requests on CentOS 6 Server.
Install Squid from CentOS repositories, make sure sure CentOS 6 Server system is up-to-date
#yum update #yum install squid
Check it Squid has been installed successfully
#ls -la /etc/squid drwxr-xr-x 2 root root 4096 Sep 4 00:15 . drwxr-xr-x 53 root root 4096 Sep 4 00:36 .. -rw-r--r-- 1 root squid 419 Aug 4 07:56 cachemgr.conf -rw-r--r-- 1 root root 419 Aug 4 07:56 cachemgr.conf.default -rw-r--r-- 1 root root 1547 Aug 4 07:56 errorpage.css -rw-r--r-- 1 root root 1547 Aug 4 07:56 errorpage.css.default -rw-r--r-- 1 root root 11651 Aug 4 07:56 mime.conf -rw-r--r-- 1 root root 11651 Aug 4 07:56 mime.conf.default -rw-r--r-- 1 root root 421 Aug 4 07:56 msntauth.conf -rw-r--r-- 1 root root 421 Aug 4 07:56 msntauth.conf.default -rw-r----- 1 root squid 3948 Sep 4 00:14 squid.conf -rw-r--r-- 1 root root 2425 Aug 4 07:56 squid.conf.default
Configuring Squid as an HTTP web proxy.
Edit the Squid configuration file /etc/squid/squid.conf
This squid configuration set all IP address may connect or using this as HTTP web proxy
# vi /etc/squid/squid.conf
Add the following lines
http_access allow all
Run Squid http web proxy
#service squid start
Setup Squid for anonymous traffic and mask original local IP address.
Add the following lines to Squid configuration file.
#vi /etc/squid/squid.conf
forwarded_for off request_header_access Allow allow all request_header_access Authorization allow all request_header_access WWW-Authenticate allow all request_header_access Proxy-Authorization allow all request_header_access Proxy-Authenticate allow all request_header_access Cache-Control allow all request_header_access Content-Encoding allow all request_header_access Content-Length allow all request_header_access Content-Type allow all request_header_access Date allow all request_header_access Expires allow all request_header_access Host allow all request_header_access If-Modified-Since allow all request_header_access Last-Modified allow all request_header_access Location allow all request_header_access Pragma allow all request_header_access Accept allow all request_header_access Accept-Charset allow all request_header_access Accept-Encoding allow all request_header_access Accept-Language allow all request_header_access Content-Language allow all request_header_access Mime-Version allow all request_header_access Retry-After allow all request_header_access Title allow all request_header_access Connection allow all request_header_access Proxy-Connection allow all request_header_access User-Agent allow all request_header_access Cookie allow all request_header_access All deny all
Save and exit then restart squid for the squid configuration applied changes
#service squid restart