hcwzwx 发表于 2018-12-27 07:40:03

RHEL5.0 Squid配置

squid.conf文件如下  http_port 3128
  hierarchy_stoplist cgi-bin ?
  acl QUERY urlpath_regex cgi-bin \?
  no_cache deny QUERY
  cache_mem 32 MB
  cache_swap_low 80
  cache_swap_high 95
  cache_access_log /usr/local/squid/logs/access.log
  cache_dir ufs /usr/local/squid/cache 100 16 256
  cache_log /usr/local/squid/logs/cache.log
  cache_store_log none
  error_directory /usr/local/etc/squid/errors/Simplify_Chinese
  icon_directory /usr/local/etc/squid/icons
  logfile_rotate 10
  auth_param basic program /usr/local/sbin/ncsa_auth /usr/local/etc/squid/passwd
  auth_param basic children 5
  auth_param basic realm
请输入你的用户名和密码  auth_param basic credentialsttl 2 hours
  refresh_pattern ^ftp:         1440    20%   10080
  refresh_pattern ^gopher:      1440    0%      1440
  refresh_pattern .               0       20%   4320
  acl password proxy_auth REQUIRED
  acl all src 0/0
  acl Manager proto cache_object
  acl Localhost src 127.0.0.1/32
  acl Safe_ports port 80 21 443 563 70 210 280 488 591 777 1025-65535
  acl SSL_ports port 443 563 1630
  acl CONNECT method CONNECT
  acl MyNetwork src 192.168.0.0/24
  http_access allow Manager Localhost
  http_access deny Manager
  http_access deny !Safe_ports
  http_access deny CONNECT !SSL_ports
  http_access allow password
  http_access deny all
  http_reply_access allow all
  icp_access allow all
  2.使用cachemgr.cgi    1)cachemgr.cgi配置过程    squid本身提供一个cgi程序,文件名为cachemgr.cgi,squid安装完后将它复制到Apache服务器下的cgi-bin这个目录下即可使用。   #cp /usr/lib/squid/cachemgr.cgi /var/www/cgi-bin    为什么要复制到/var/www/cgi-bin里面呢?原因是我的/etc/httpd/conf/httpd.conf里面有配置ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"   AllowOverride None      Options None   Order allow,deny   Allow from all下面我们通过apache进行监控squid ,修改配置文件/etc/httpdconf/httpdconf,添加以下内容:              AuthType Basic  AuthName "Squidadmin"  AuthUserFile /usr/local/squid/etc/squid.pwd  require valid-user      生成口令文件:     #cd /usr/local/squid/etc  #htpasswd -c squid.pwd squidadmin   “
创建密码文件 ”  New passwd:  Re-type new passwd:  Adding password for user squidadmin  #chown apache:apache squid.pwd“将认证口令文件的属主改为apache”      重启squid与http ,要察看Cache Manager提供的信息时,请在浏览器的地址列中键入 http://服务器的名称或IP地址/cgi-bin/cachemgr.cgi。首先看到用户认证界面,经过认证后进入登录界面,输入代理服务器地址和端口号 。

页: [1]
查看完整版本: RHEL5.0 Squid配置