- Cài đặt squid3 khá đơn giản
apt-get install squid3
Chú ý là dòng lệnh apt-get install squid sẽ cài đặt squid phiên bản 2
2. Tiếp theo là biên tập file cấu hình /etc/squid3/squid.conf
acl LocalNet src IP_RPi/24 # RFC1918 possible internal network 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 deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow localhost manager http_access deny manager http_access allow LocalNet http_access allow localhost http_access deny all http_port 3128 http_port IP_RPi:3129 intercept cache_mem 256 MB maximum_object_size_in_memory 8192 KB maximum_object_size 4096 MB cache_dir ufs /mnt/proxy/cache 8192 16 256 access_log /mnt/proxy/logs/access.log cache_store_log /mnt/proxy/logs/store.log cache_log /mnt/proxy/logs/cache.log coredump_dir /mnt/proxy/ 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 dns_v4_first on
3. Tạo các thư mục cần thiết
mkdir /mnt/proxy/{cache, logs}
cd /mnt
chown -Rv proxy:proxy proxy
4. Khởi tạo cache
sudo squid3 –z
5. Chạy squid server
sudo service squid3 start
6. Sử dụng proxy
Có thể cài đặt proxy cho từng browser, từng máy tính hay cài đặt cho router (re-route any traffic destined to port 80 to port 3128 of raspberry pi)
Địa chỉ proxy là IP_RPi:3128