sudo yum install squid -y
sudo vi /etc/squid/squid.conf 找到以下几行并注释 http_access deny CONNECT !SSL_ports http_access deny !Safe_ports http_access deny to_localhost
sudo systemctl start squid
sudo systemctl restart squid
tail -f /var/log/squid/access.log
用openssl来生成密码,并且附加username:password对到文件/etc/squid/htpasswd文件中,并且显示出来。
如果你还没有安装openssl,可使用如下语法安装:
sudo yum install openssl openssl-devel
生成用户名密码的语法如下:
printf "USERNAME:$(openssl passwd PASSWORD)\n" | sudo tee -a /etc/squid/htpasswd
例如:创建一个用户名称为wangxch,并且密码为Pz$lPk76,你将要运行:
printf "wangxch:$(openssl passwd -crypt 'Pz$lPk76')\n" | sudo tee -a /etc/squid/htpasswd
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/htpasswd auth_param basic realm proxy acl authenticated proxy_auth REQUIRED # ... http_access allow localnet http_access allow localhost http_access allow authenticated # And finally deny all other access to this proxy http_access deny all
sudo systemctl restart squid
上一篇:centos系统版本升级