Squid-Cache Web Accelerator on Red Hat (CentOS) Distrubutions

From Kathmann Labs

Jump to: navigation, search

[edit] Squid-Cache Web Accelerator on Red Hat (CentOS) Distributions How-to

NOTE: These are instructions for CentOS, a Red Hat clone. Replace the "yum" command with "up2date" if you are actually using Red Hat.

Install Red Hat / CentOS linux

Install CentOS to a VM

Install Squid cache

  • yum install squid - installs squid on your machine

Configure Squid cache

  • vi /etc/squid/squid.conf
  • uncomment and change the http_port line to http_port 80 - you can use any port you want, TCP/80 is the standard HTTP. TCP/443 is the standard HTTPS port
  • uncomment the httpd_accel_port 80
  • uncomment or add the line httpd_accel_host <your original website url>
  • add a line to represent your web server(s) (or all servers you want this proxy server to handle) to the ACCESS CONTROLS section of the config file
  • add a line like acl mysite dst 192.168.0.1/255.255.255.255 where 192.168.0.1 is the ip address of your website. You can also change the mysite to whatever you want
  • search for the "http_access deny all" string by typing in ESC then /http_access deny all - this should bring you to that line
  • add the following before that line - http_access allow mysite (or the acl name you created)

Add ports to firewall

  • vi /etc/sysconfig/iptables - add the following lines
  • -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Enable Squid on startup

  • chkconfig --levels 2345 squid on - turns on squid for automatic start on boot in runlevels 2,3,4, and 5

Start the daemon (and restart iptables)

  • /etc/init.d/iptables restart - restarts the iptables daemon and reloads the changes made above
  • /etc/init.d/squid start - starts the squid daemons
Personal tools
extras