差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
下次修改
前次修改
squid [2017/01/07 16:30]
jz
squid [2018/12/29 21:39] (目前版本)
jz
行 1: 行 1:
-====== ​squid ======+====== ​Squid ======
  
-===== install ​=====+===== Install ​=====
  
-<​code ​sh>+<​code ​bash>
 pkg install squid pkg install squid
 +pkg install htdigest
 sysrc squid_enable="​YES"​ sysrc squid_enable="​YES"​
 </​code>​ </​code>​
  
-===== config ​=====+===== Auth ===== 
 +There are two ways to specify the password auth, ''​htdigest''​ or ''​htpasswd''​. 
 + 
 +**htdigest**
  
 ''/​usr/​local/​etc/​squid/​squid.conf''​ ''/​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>​ <​code>​
 auth_param digest realm proxy auth_param digest realm proxy
 auth_param digest program /​usr/​local/​libexec/​squid/​digest_file_auth -c /​usr/​local/​etc/​squid/​password 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 users proxy_auth REQUIRED
 +acl ncku src 140.116.0.0/​16
 +http_access deny !ncku
 http_access allow users http_access allow users
- 
 http_port 3128 http_port 3128
 +</​code>​
  
-# Leave coredumps in the first cache dir +===== Check config =====
-coredump_dir /​var/​squid/​cache+
  
-# +<code bash> 
-# Add any of your own refresh_pattern entries above these. +squid -/usr/local/​etc/​squid/​squid.conf -k parse
-+
-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+
 </​code>​ </​code>​
  
-<code sh> +===== Start service =====
-apache-htdigest -c /​usr/​local/​etc/​squid/​passwords realm username +
-# or htdigest if apache-htdigest is not found +
-</​code>​+
  
-===== check config ===== +<​code ​bash
- +service ​squid start
-<​code ​sh+
-squid -f /​usr/​local/​etc/​squid/​squid.conf -k parse+
 </​code>​ </​code>​
 +