顯示頁面 舊版 反向連結 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== Squid ====== ===== Install ===== <code bash> pkg install squid pkg install htdigest sysrc squid_enable="YES" </code> ===== Auth ===== There are two ways to specify the password auth, ''htdigest'' or ''htpasswd''. **htdigest** ''/usr/local/etc/squid/squid.conf'' <code> auth_param basic program /usr/local/libexec/squid/basic_ncsa_auth /usr/local/etc/squid/password auth_param basic realm proxy auth_param basic casesensitive </code> <code bash> apache-htdigest -c /usr/local/etc/squid/password realm username # or htdigest if apache-htdigest is not found </code> <code bash> php -a echo 'user': . crypt('password', base64_encode('password')); </code> **htpasswd** ''/usr/local/etc/squid/squid.conf'' <code> auth_param digest realm proxy auth_param digest program /usr/local/libexec/squid/digest_file_auth -c /usr/local/etc/squid/password </code> <code bash> htpasswd -c /usr/local/etc/squid/password username </code> ===== ACL ===== ''/usr/local/etc/squid/squid.conf'' <code> acl users proxy_auth REQUIRED acl ncku src 140.116.0.0/16 http_access deny !ncku http_access allow users http_port 3128 </code> ===== Check config ===== <code bash> squid -f /usr/local/etc/squid/squid.conf -k parse </code> ===== Start service ===== <code bash> service squid start </code>