Centos 6.8 Htpass 错误中的 Squid 代理

Posted

技术标签:

【中文标题】Centos 6.8 Htpass 错误中的 Squid 代理【英文标题】:Squid Proxy in Centos 6.8 Htpass Error 【发布时间】:2016-12-12 11:19:27 【问题描述】:

我尝试在使用 Centos 6.8 的私人服务器中配置 Squid 代理服务器(版本 3.1.23), 这是我的鱿鱼配置

#A Port you would like to use
http_port 3128

acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines

acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT

http_access allow manager localhost
http_access deny manager
http_access allow localnet
http_access allow localhost
hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|?) 0 0% 0
refresh_pattern . 0 20% 4320
#Your Personal IP to allow without authentication
acl myclients src "my client IP"
#Allow this IP without authentication 
http_access allow myclients 


auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/squid_access 
auth_param basic childred 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
acl ncsaauth proxy_auth REQUIRED
http_access allow ncsaauth
forwarded_for off

#Enter your servers IP here
acl ip1 myip "my Server IP"
tcp_outgoing_address "my Server IP"

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

#Allocate 3GB for Caching
cache_dir ufs /var/spool/squid 3000 16 256 
#Maximum Cache Object 1GB
maximum_object_size 1024 KB 
#Use 1GB RAM for Cache 
cache_mem 1024 MB 

当我尝试使用为我的代理创建用户名和密码时

touch /etc/squid/squid_access; htpasswd /etc/squid/squid_access admin

我有错误

-bash: htpasswd: command not found

我不知道如何解决这个问题,请大家帮我解决这个问题

【问题讨论】:

【参考方案1】:

我猜你错过了 apache 包 的安装尝试在你的 centos 机器上安装 apache package 然后执行 htpasswd 命令它会起作用。

【讨论】:

htpasswd 由 CentOS 6 上的 httpd-tools 软件包提供

以上是关于Centos 6.8 Htpass 错误中的 Squid 代理的主要内容,如果未能解决你的问题,请参考以下文章

Centos 6.8 DHCP设置

Letsencrypt 证书在 CentOS 6.8 32 位版本中不起作用

CentOS Linux 6.8正式发布

centos 6.8安装redis

centos 6.8 上没有可用的软件包 mod_fastcgi

CentOS 6.8安装Python2.7.13