Linux OS Service ‘squid’

Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. Squid offers a rich access control, authorization and logging environment to develop web proxy and content serving applications.The Squid caching proxy server can also be configured as a reverse proxy to redirect http (Port 80) connections. When acting as a reverse proxy, the cached content is delivered from the proxy server to the client without exposing the origin of the web server or data on the internal network.

The RPM package containing this service: squid

Service Control

To obtain the squid service, install the squid RPM package using yum.

# yum install squid

....
Dependencies Resolved

====================================================================================================================
 Package                                                 Arch                                   Version             
====================================================================================================================
Installing:
 squid                                                   x86_64                                 7:3.5.20-10.el7     
Installing for dependencies:
 libecap                                                 x86_64                                 1.0.0-1.el7         
 libtool-ltdl                                            x86_64                                 2.4.2-22.el7_3      
 perl-Compress-Raw-Bzip2                                 x86_64                                 2.061-3.el7         
 perl-Compress-Raw-Zlib                                  x86_64                                 1:2.061-4.el7       
 perl-DBI                                                x86_64                                 1.627-4.el7         
 perl-Data-Dumper                                        x86_64                                 2.145-3.el7         
 perl-Digest                                             noarch                                 1.17-245.el7        
 perl-Digest-MD5                                         x86_64                                 2.52-3.el7          
 perl-IO-Compress                                        noarch                                 2.061-2.el7         
 perl-Net-Daemon                                         noarch                                 0.48-5.el7          
 perl-PlRPC                                              noarch                                 0.2020-14.el7       
 squid-migration-script                                  x86_64                                 7:3.5.20-10.el7     

Transaction Summary
====================================================================================================================
Install  1 Package (+12 Dependent packages)

Total download size: 4.5 M
Installed size: 14 M
Is this ok [y/d/N]: 

To manage the squid service for future system shutdowns and reboots, use the chkconfig tool:

# chkconfig squid on
# chkconfig --list squid
squid           0:off   1:off   2:on    3:on    4:on    5:on    6:off
# chkconfig squid off

To control the squid service immediately, use the service tool:

# service squid
Usage: /etc/init.d/squid {start|stop|status|reload|restart|condrestart}

Configuration

The configuration file for squid is /etc/squid/squid.conf :

# cat /etc/squid/squid.conf

#       WELCOME TO SQUID 2.6.STABLE6
#       ----------------------------
#
#       This is the default Squid configuration file. You may wish
#       to look at the Squid home page (http://www.squid-cache.org/)
#       for the FAQ and other documentation.
#
#       The default Squid config file shows what the defaults for
#       various options happen to be.  If you don't need to change the
#       default, you shouldn't uncomment the line.  Doing so may cause
#       run-time problems.  In some cases "none" refers to no default
#       setting at all, while in other cases it refers to a valid
#       option - the comments for that keyword indicate if this is the
#       case.
#


# NETWORK OPTIONS
# -----------------------------------------------------------------------------

#  TAG: http_port
#       Usage:  port [options]
#               hostname:port [options]
#               1.2.3.4:port [options]
http_port 80 # Port of Squid proxy
httpd_accel_host 10.10.1.110 # IP address of web server
httpd_accel_port 80 # Port of web server
httpd_accel_single_host on # Forward uncached requests to single host
httpd_accel_with_proxy on #
httpd_accel_uses_host_header off

Here,
http_port 80 – The port 80 is the port that the squid server will be listening on.
httpd_accel_single_host on – This option informs squid that all requests should go to a single host.
httpd_accel_host 10.10.1.110 – This address should be changed to the address of the web server.
httpd_accel_uses_host_header off – This option tells squid not to add any proxy-style headers to any content that will be sent to the client.
httpd_accel_port 80 – This address is the port on which the remote web server is listening on.

Related Post