เข้า putty แล้วพิม vi /etc/squid/squid.conf กด enter ตอนจะพิมก็กด Insert
เพิ่ม 2 บรรทัดน๊ะครับ ดูสีแดงนะคับ แล้วดูตำแหน่งการว่างให้ถูกต้องนะครับ
ให้วางบรรทัด http_access deny blockweb ไว้บนบรรทัดนี้ครับ http_access allow webconfig_lan
###############################################################
# webconfig: http_port_start
http_port 192.168.1.1:3128
http_port 127.0.0.1:3128
# webconfig: http_port_end
cache_mem 16 MB
cache_swap_low 90
cache_swap_high 95
maximum_object_size 614400 KB
minimum_object_size 0 KB
maximum_object_size_in_memory 8 KB
cache_replacement_policy heap GDSF
memory_replacement_policy heap GDSF
cache_dir ufs /var/spool/squid 2512 16 256
cache_access_log /var/log/squid/access.log
# cache_log /var/log/squid/cache.log
# cache_store_log /var/log/squid/store.log
#emulate_httpd_log on
mime_table /etc/squid/mime.conf
pid_filename /var/run/squid.pid
ftp_user Squid@
ftp_list_width 32
ftp_passive on
ftp_sanitycheck on
redirect_children 3
auth_param basic program /usr/lib/squid/squid_ldap_auth -b "dc=clarkconnect,dc=lan" -f "(&(objectClass=pcnProxyAccount)(uid=%s))" -h 127.0.0.1 -D "cn=manager,cn=internal,dc=clarkconnect,dc=lan" -W /etc/squid/ldap.conf -s one -v 3 -U pcnProxyPassword -d
auth_param basic children 5
auth_param basic realm ClarkConnect Enterprise Edition - Web Proxy
auth_param basic credentialsttl 2 hours
refresh_pattern -i \.*$ 0 100% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern -i ^http://www.*.co.th 0 100% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern -i ^http://www.*.com 0 100% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern -i ^http://www.*.net 0 100% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern -i ^http://www.*.in.th 0 100% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern -i ^http://www.*.org 0 100% 1440 override-lastmod override-expire reload-into-ims ignore-reload
refresh_pattern ^gopher://.*\.*$ 0 20% 1440
refresh_pattern ^http://.*\.*$ 0 20% 1440
refresh_pattern ^ftp://.*\.*$ 0 20% 1440
refresh_pattern ^ftp: 0 20% 1440
refresh_pattern ^gopher: 0 0% 1440
refresh_pattern . 0 20% 1440
quick_abort_min 16 KB
quick_abort_max 16 KB
quick_abort_pct 95
shutdown_lifetime 5 seconds
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
#acl password proxy_auth REQUIRED
acl password proxy_auth REQUIRED
# webconfig: acl_start
acl webconfig_lan src 192.168.1.0/24
acl blockweb dstdomain www.sanook.com www.doo-dd.com อยากบล็อกเว๊ปอะไรก็ใส่เพิ่มเองน๊ะครับ
# webconfig: acl_end
acl privoxy dstdomain config.privoxy.org
acl SSL_ports port 443 563
acl SSL_ports port 81 10000
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https, snews
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 Safe_ports port 81 82 83 10000 # Web-based administration tools
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny privoxy
http_access allow localhost
http_access deny blockweb
http_access allow webconfig_lan
http_access allow all
http_reply_access allow all
icp_access allow all
reply_body_max_size 0 allow all
cache_mgr root
cache_effective_user squid
cache_effective_group squid
visible_hostname proxy
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
logfile_rotate 0
forwarded_for on
coredump_dir /var/spool/squid
ie_refresh on
###########################################################
เพิ่ม ที่เป็นสีแดง
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 81 82 83 10000 # Web-based administration tools
acl port port 3000-3001 # ntop
acl FILE_BT urlpath_regex -i \.torrent$ <== บล็อกนามสกุล Bittorrent
acl domain dstdom_regex "/etc/squid/block_domains.txt" <== Link ไปอ่านในไฟล์ block_domains.txt
acl CONNECT method CONNECT
http_access deny domain
http_access deny FILE_BT
http_access allow port
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
แล้วเพิ่ม รายชื่อ web ที่ vi /etc/squid/block_domains.txt
www.siambit.com
www.bittorrent.com
หมายเหตุ เอาเท่าที่จำเป็นนะครับ มันกระทบความเร็วในการเรียกเน็ต ยิ่งมากก็โหลด Server มาก
หลังเพิ่ม squid จะแจ้ง Error โดยไปเรียกไฟล์ชื่อ ERR_ACCESS_DENIED
vi /ect/squid/error/ERR_ACCESS_DENIED
ลองแก้ไขข้อความตามใจเรา * เป็น ไฟล์ html