Squid服务说明
Squid 是支持 HTTP、HTTPS、FTP 等的 Web 缓存代理。
Squid 提供了丰富的访问控制、授权和日志环境来开发 Web 代理和内容服务应用程序。
Squid 缓存代理服务器还可以配置为反向代理以重定向 http(端口 80)连接。
当充当反向代理时,缓存的内容从代理服务器传送到客户端,而不会暴露 Web 服务器的来源或者内部网络上的数据。
包含此服务的 RPM 包:squid
配置squid
squid 的配置文件是 /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
其中:
http_port 80 端口 80 是 squid 服务器将监听的端口。
httpd_accel_single_host on 此选项通知squid 所有请求都应发送到单个主机。
httpd_accel_host 10.10.1.110 这个地址应该改成web服务器的地址。
httpd_accel_uses_host_header off 这个选项告诉squid 不要向将发送到客户端的任何内容添加任何代理风格的头部。
httpd_accel_port 80 此地址是远程 Web 服务器正在侦听的端口。
欢迎 on
it
road
服务控制
要获取squid 服务,请使用yum 安装squid RPM 包。
# yum install squid
要为将来的系统关闭和重新启动管理 squid 服务,请使用 chkconfig 工具:
# chkconfig squid on # chkconfig --list squid squid 0:off 1:off 2:on 3:on 4:on 5:on 6:off # chkconfig squid off
要立即控制Squid服务,请使用服务工具:
# service squid Usage: /etc/init.d/squid {start|stop|status|reload|restart|condrestart}
日期:2020-09-17 00:14:39 来源:oir作者:oir