oke langsung saja dibuka terminalnya lalu ketikan perintah dibawah ini untuk mengedit konfigurasi squid
sudo gedit /etc/squid/squid.conf
lalu hapus seluruh isinya dan ganti dengan dibawah ini dan sesuaikan keadaannya di kompi lo,contoh di gw partisi cache gw buat di /cache dengan alokasi size 6Gb lalu alokasi sebesar 4Gb
#################################
# HIGH PERFORMANCE SQUID 2.7
# Config date : 21 April 2010
#################################
# ACCESS CONTROLS
# ---------------
acl QUERY urlpath_regex -i cgi-bin \? \.php$ \.asp$ \.shtml$ \.cfm$ \.cfml$ \.phtml$ \.php3$ localhost
acl localnet src 10.0.0.0/8
acl localnet src 172.16.0.0/12
acl localnet src 192.168.0.0/16
acl all src 0.0.0.0/0.0.0.0
acl localhost src 127.0.0.1/32
acl safeports port 21 70 80 210 280 443 488 563 591 631 777 901 81 3128 1025-65535
acl sslports port 443 563 81
acl manager proto cache_object
acl purge method PURGE
acl connect method CONNECT
acl ym dstdomain .messenger.yahoo.com .psq.yahoo.com
acl ym dstdomain .us.il.yimg.com .msg.yahoo.com .pager.yahoo.com
acl ym dstdomain .rareedge.com .ytunnelpro.com .chat.yahoo.com
acl ym dstdomain .voice.yahoo.com
acl ymregex url_regex yupdater.yim ymsgr myspaceim
http_access deny ym
http_access deny ymregex
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !safeports
http_access deny CONNECT !sslports
http_access allow localhost
http_access allow localnet
http_access deny all
# NETWORK OPTIONS
# ---------------
http_port 3128 transparent
icp_access deny all
# OPTIONS WHICH AFFECT THE CACHE SIZE
# -----------------------------------
cache_mem 8 MB
maximum_object_size_in_memory 32 KB
memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA
cache_dir aufs /cache 4000 10 256
maximum_object_size 128000 KB
cache_swap_low 90
cache_swap_high 95
update_headers off
# LOGFILE PATHNAMES AND CACHE DIRECTORIES
# ---------------------------------------
#access_log /cache/access.log
access_log none
cache_log /cache/cache.log
#cache_log /dev/null
cache_store_log none
logfile_rotate 5
log_ip_on_direct off
log_icp_queries off
buffered_logs off
netdb_filename none
client_db off
#pid_filename /var/run/squid.pid
# OPTIONS FOR TUNING THE CACHE
# ----------------------------
cache deny QUERY
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i \.(gif|png|jp?g|ico|bmp|tiff?)$ 10080 95% 43200 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private
refresh_pattern -i \.(rpm|cab|deb|exe|msi|msu|zip|tar|gz|tgz|rar|bin|7z|doc?|xls?|ppt?|pdf|nth|psd|sis)$ 10080 90% 43200 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private
refresh_pattern -i \.(avi|iso|wav|mid|mp?|mpeg|mov|3gp|wm?|swf|flv|x-flv|axd)$ 43200 95% 432000 override-expire override-lastmod reload-into-ims ignore-no-cache ignore-private
refresh_pattern -i \.(html|htm|css|js)$ 1440 75% 40320
refresh_pattern -i \.index.(html|htm)$ 0 75% 10080
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 1440 90% 10080
quick_abort_min 0 KB
quick_abort_max 0 KB
quick_abort_pct 100
store_avg_object_size 13 KB
# HTTP OPTIONS
# ------------
server_http11 on
collapsed_forwarding on
vary_ignore_expire on
# ANONIMITY OPTIONS
# -----------------
header_access From deny all
header_access Server deny all
header_access Link deny all
header_access Via deny all
header_access X-Forwarded-For deny all
# TIMEOUTS
# --------
forward_timeout 240 second
connect_timeout 30 second
peer_connect_timeout 5 second
read_timeout 600 second
request_timeout 60 second
persistent_request_timeout 60 second
client_lifetime 86400 second
half_closed_clients off
pconn_timeout 60 second
shutdown_lifetime 10 second
# ADMINISTRATIVE PARAMETERS
# -------------------------
cache_mgr Rh354
cache_effective_user proxy
cache_effective_group proxy
httpd_suppress_version_string on
visible_hostname Rh354
# ADVANCED NETWORKING OPTIONS
# ---------------------------
max_filedescriptors 2048
# DNS OPTIONS
# -----------
check_hostnames off
#DNS NAWALA
dns_nameservers 180.131.144.144
dns_nameservers 180.131.144.145
hosts_file /etc/hosts
ipcache_size 8192
ipcache_low 90
ipcache_high 95
# MISCELLANEOUS
# -------------
memory_pools off
forwarded_for off
reload_into_ims on
coredump_dir /cache
pipeline_prefetch on
offline_mode off
###### END CONFIGURATION ###########
save file tersebut lalu buat file baru melalui terminal
sudo gedit /etc/init.d/squid
isi file tersebut dengan skrip ini
cek scriptnya
Show »
Data provided by Pastebin.com - Download Raw
1.
#! /bin/sh
2.
#
3.
# squid Startup script for the SQUID HTTP proxy-cache.
4.
#
5.
# Version: @(#)squid.rc 2.20 01-Oct-2001 miquels@cistron.nl
6.
#
7.
### BEGIN INIT INFO
8.
# Provides: squid
9.
# Required-Start: $network $remote_fs $syslog
10.
# Required-Stop: $network $remote_fs $syslog
11.
# Should-Start: $named
12.
# Should-Stop: $named
13.
# Default-Start: 2 3 4 5
14.
# Default-Stop: 0 1 6
15.
# Short-Description: Squid HTTP Proxy
16.
### END INIT INFO
17.
18.
NAME=squid
19.
DAEMON=/usr/sbin/squid
20.
LIB=/usr/lib/squid
21.
PIDFILE=/var/spool/squid/logs/$NAME.pid
22.
SQUID_ARGS="-D -YC"
23.
24.
[ ! -f /etc/default/squid ] || . /etc/default/squid
25.
26.
. /lib/lsb/init-functions
27.
28.
PATH=/bin:/usr/bin:/sbin:/usr/sbin
29.
30.
[ -x $DAEMON ] || exit 0
31.
32.
grepconf () {
33.
w=" " # space tab
34.
sq=/etc/squid/squid.conf
35.
# sed is cool.
36.
res=`sed -ne '
37.
s/^'$1'['"$w"']+([^'"$w"']+).*$/ /p;
38.
t end;
39.
d;
40.
:end q' < $sq`
41.
[ -n "$res" ] || res=$2
42.
echo "$res"
43.
}
44.
45.
grepconf2 () {
46.
w=" " # space tab
47.
sq=/etc/squid/$NAME.conf
48.
# sed is cool.
49.
res=`sed -ne '
50.
s/^'$1'['"$w"']+[^'"$w"']+['"$w"']+([^'"$w"']+).*$/ /p;
51.
t end;
52.
d;
53.
:end q' < $sq`
54.
[ -n "$res" ] || res=$2
55.
echo "$res"
56.
}
57.
58.
#
59.
# Try to increase the # of filedescriptors we can open.
60.
#
61.
maxfds () {
62.
[ -n "$SQUID_MAXFD" ] || return
63.
[ -f /proc/sys/fs/file-max ] || return 0
64.
global_file_max=`cat /proc/sys/fs/file-max`
65.
minimal_file_max=$(($SQUID_MAXFD + 4096))
66.
if [ "$global_file_max" -lt $minimal_file_max ]
67.
then
68.
echo $minimal_file_max > /proc/sys/fs/file-max
69.
fi
70.
ulimit -n $SQUID_MAXFD
71.
}
72.
73.
start () {
74.
cdr=`grepconf2 cache_dir /var/spool/$NAME`
75.
ctp=`grepconf cache_dir ufs`
76.
77.
case "$cdr" in
78.
[0-9]*)
79.
log_failure_msg "squid: squid.conf contains 2.2.5 syntax - not starting!"
80.
log_end_msg 1
81.
exit 1
82.
;;
83.
esac
84.
85.
#
86.
# Create spool dirs if they don't exist.
87.
#
88.
if [ -d "$cdr" -a ! -d "$cdr/00" ] || [ "$ctp" = "coss" -a ! -w "$cdr" ]
89.
then
90.
log_warning_msg "Creating squid cache structure"
91.
$DAEMON $SQUID_ARGS -z
92.
fi
93.
94.
if [ "$CHUID" = "" ]; then
95.
CHUID=root
96.
fi
97.
98.
maxfds
99.
umask 027
100.
start-stop-daemon --quiet --start
101.
--pidfile $PIDFILE
102.
--chuid $CHUID
103.
--exec $DAEMON -- $SQUID_ARGS < /dev/null
104.
return $?
105.
}
106.
107.
stop () {
108.
PID=`cat $PIDFILE 2>/dev/null`
109.
start-stop-daemon --stop --quiet --pidfile $PIDFILE --name squid
110.
#
111.
# Now we have to wait until squid has _really_ stopped.
112.
#
113.
sleep 2
114.
if test -n "$PID" && kill -0 $PID 2>/dev/null
115.
then
116.
log_action_begin_msg " Waiting"
117.
cnt=0
118.
while kill -0 $PID 2>/dev/null
119.
do
120.
cnt=`expr $cnt + 1`
121.
if [ $cnt -gt 24 ]
122.
then
123.
log_action_end_msg 1
124.
return 1
125.
fi
126.
sleep 5
127.
log_action_cont_msg ""
128.
done
129.
log_action_end_msg 0
130.
return 0
131.
else
132.
return 0
133.
fi
134.
}
135.
136.
case "$1" in
137.
start)
138.
log_daemon_msg "Starting Squid HTTP proxy" "squid"
139.
if start ; then
140.
log_end_msg $?
141.
else
142.
log_end_msg $?
143.
fi
144.
;;
145.
stop)
146.
log_daemon_msg "Stopping Squid HTTP proxy" "squid"
147.
if stop ; then
148.
log_end_msg $?
149.
else
150.
log_end_msg $?
151.
fi
152.
;;
153.
reload|force-reload)
154.
log_action_msg "Reloading Squid configuration files"
155.
$DAEMON -k reconfigure
156.
log_action_end_msg 0
157.
;;
158.
restart)
159.
log_daemon_msg "Restarting Squid HTTP proxy" "squid"
160.
stop
161.
if start ; then
162.
log_end_msg $?
163.
else
164.
log_end_msg $?
165.
fi
166.
;;
167.
status)
168.
status_of_proc -p "$PIDFILE" "$DAEMON" squid && exit 0 || exit $?
169.
;;
170.
*)
171.
echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart|status}"
172.
exit 3
173.
;;
174.
esac
175.
176.
exit 0
save sebagai file squid di /etc/init.d lalu di chmod agar bisa di eksekusi
sudo chmod +x /etc/init.d/squid
jangan lupa di change owner tuk partisi squid
sudo chown -R proxy:proxy /cache
cek konfigurasi squid
sudo squid -k parse
kalo ga’ ada error silahkan dilanjutkan..Build cache dengan mengetikkan
sudo squid -z
restart squidnya
sudo /etc/init.d/squid restart
set aktif saat boot
sudo update-rc.d squid defaults
setting di browser kesayangan..dalam hal ini mozilla firefox
buka FF -> edit -> preferences -> advanced
di tab advanced masuk ke network
setel offline storage ke 0 lalu clear now
masuk ke connection -> setting
pilih manual proxy configuration, di HTTP Proxy setel 127.0.0.1 port 3128 lalu centang use this proxy server for all protocols
untuk memudahkan koneksi messenger lebih baik jangan setting messenger tuk melewati port squid jadi silahkan di cek bener2 n pastikan pilihan ke no proxy di messenger :)
Home »
» Konfigurasi Squid 2.7 Stable 9
Konfigurasi Squid 2.7 Stable 9
Posted by eka
Posted on 13:50