Ads 468x60px

Friday, October 19, 2012

Membangun Windows Proxy Server Dengan Squid 2.7 Stable 8

Bagaimana merubah Windows XP menjadi server proxy? Secara bawaan Windows XP tidak bisa dijadikan server proxy. Karena Sistem Operasi besutan Microsoft ini bukan ditujukan untuk komputer server melainkan untuk komputer client. Lantas bagaimana agar bisa? Jawabannya dengan Squid.
Instalasi Squid 2.7 Stable8 di Windows XP
Instalasi Squid 2.7 Stable8 di Windows XP
Apa itu squid? Squid adalah aplikasi open source proxy yang biasanya diinstal dalam lingkungan linux. Squid akan menyimpan beberapa file seperti image, video, audio, script, dari hasil browsing ke dalam harddisk lokal. Dengan begitu browser tidak perlu mengambil file secara langsung dari internet, browser hanya mengambil beberapa file yang tidak ada atau belum tersimpan di harddisk lokal tadi. Hal ini membuat loading browser semakin cepat saat kita mengunjungi situs yang sama berulang kali. Manfaat lain yang dapat dirasakan adalah pengehematan bandwidth atau kuota.
Persiapan Yang Perlu Dilakukan
cachemgr.conf.default => cachemgr.conf
mime.conf.default => mime.conf
squid.conf.default => squid.conf
squid_radius_auth.conf.default => squid_radius_auth.conf
Konfigurasi Squid
Sekarang kita masuk ketahap instalasi. Edit file squid.conf yang baru saja diubah namanya menggunakan Notepad++.
  • Cari http_port 3128
Pastikan tidak ada tanda # di depan baris tersebut.
  • Cari TAG: visible_hostname
Kurang lebih isinya sebagai berikut:
#  TAG: visible_hostname
# If you want to present a special hostname in error messages, etc,
# define this.  Otherwise, the return value of gethostname()
# will be used. If you have multiple caches in a cluster and
# get errors about IP-forwarding you must set them to have individual
# names with this setting.
#
#Default:
# none
Tambahkan visible_hostname localhost di bawah tulisan #none.
  • Cari TAG: http_access
Anda akan menemukan kode berikut:
#  TAG: http_access
# Allowing or Denying access based on defined access lists
#
# Access to the HTTP port:
# http_access allow|deny [!]aclname …
#
# NOTE on default values:
#
# If there are no “access” lines present, the default is to deny
# the request.
#
# If none of the “access” lines cause a match, the default is the
# opposite of the last line in the list.  If the last line was
# deny, the default is allow.  Conversely, if the last line
# is allow, the default will be deny.  For these reasons, it is a
# good idea to have an “deny all” or “allow all” entry at the end
# of your access lists to avoid potential confusion.
#
#Default:
# http_access deny all
#
#Recommended minimum configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
# Deny requests to unknown ports
http_access deny !Safe_ports
# Deny CONNECT to other than SSL ports
http_access deny CONNECT !SSL_ports
#
# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on “localhost” is a local user
#http_access deny to_localhost
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
Tambahkan http_access allow localhost dibawah http_access allow localnet.
  • Cari TAG: dns_nameservers
Anda akan menemukan tulisan berikut:
#  TAG: dns_nameservers
# Use this if you want to specify a list of DNS name servers
# (IP addresses) to use instead of those given in your
# /etc/resolv.conf file.
# On Windows platforms, if no value is specified here or in
# the /etc/resolv.conf file, the list of DNS name servers are
# taken from the Windows registry, both static and dynamic DHCP
# configurations are supported.
#
# Example: dns_nameservers 10.0.0.1 192.172.0.4
#
#Default:
# none
Tambahkan dns_nameservers 203.130.206.250 202.134.0.155 dibawah #none (sesuaikan dengan DNS yang Anda dapat dari ISP. Contoh disini saya menggunakan DNS Speedy)
  • Cari TAG: cache_mgr
Kurang lebih Anda akan menemukan kode berikut:
#  TAG: cache_mgr
# Email-address of local cache manager who will receive
# mail if the cache dies. The default is “webmaster”.
#
#Default:
# cache_mgr webmaster
Hilangkan tanda # di depan cache_mgr webmaster dan silahkan ubah nama webmaster menjadi nama atau alamat email Anda. Contoh: cache_mgr abiytia
  • Cari TAG: cache_dir
Lihat kode berikut:
#  TAG: cache_dir
# Usage:
#
# cache_dir Type Directory-Name Fs-specific-data [options]
#
# You can specify multiple cache_dir lines to spread the
# cache among different disk partitions.
#
# Type specifies the kind of storage system to use. Only “ufs”
# is built by default. To enable any of the other storage systems
# see the –enable-storeio configure option.
#
# ‘Directory’ is a top-level directory where cache swap
# files will be stored. If you want to use an entire disk
# for caching, this can be the mount-point directory.
# The directory must exist and be writable by the Squid
# process. Squid will NOT create this directory for you.
# Only using COSS, a raw disk device or a stripe file can
# be specified, but the configuration of the “cache_swap_log”
# tag is mandatory.
#
# The ufs store type:
#
# “ufs” is the old well-known Squid storage format that has always
# been there.
#
# cache_dir ufs Directory-Name Mbytes L1 L2 [options]
#
# ‘Mbytes’ is the amount of disk space (MB) to use under this
# directory.  The default is 100 MB.  Change this to suit your
# configuration.  Do NOT put the size of your disk drive here.
# Instead, if you want Squid to use the entire disk drive,
# subtract 20% and use that value.
#
# ‘Level-1? is the number of first-level subdirectories which
# will be created under the ‘Directory’.  The default is 16.
#
# ‘Level-2? is the number of second-level subdirectories which
# will be created under each first-level directory.  The default
# is 256.
#
# The aufs store type:
#
# “aufs” uses the same storage format as “ufs”, utilizing
# POSIX-threads to avoid blocking the main Squid process on
# disk-I/O. This was formerly known in Squid as async-io.
#
# cache_dir aufs Directory-Name Mbytes L1 L2 [options]
#
# see argument descriptions under ufs above
#
# The diskd store type:
#
# “diskd” uses the same storage format as “ufs”, utilizing a
# separate process to avoid blocking the main Squid process on
# disk-I/O.
#
# cache_dir diskd Directory-Name Mbytes L1 L2 [options] [Q1=n] [Q2=n]
#
# see argument descriptions under ufs above
#
# Q1 specifies the number of unacknowledged I/O requests when Squid
# stops opening new files. If this many messages are in the queues,
# Squid won’t open new files. Default is 64
#
# Q2 specifies the number of unacknowledged messages when Squid
# starts blocking.  If this many messages are in the queues,
# Squid blocks until it receives some replies. Default is 72
#
# When Q1 < Q2 (the default), the cache directory is optimized
# for lower response time at the expense of a decrease in hit
# ratio.  If Q1 > Q2, the cache directory is optimized for
# higher hit ratio at the expense of an increase in response
# time.
#
# The coss store type:
#
# block-size=n defines the “block size” for COSS cache_dir’s.
# Squid uses file numbers as block numbers.  Since file numbers
# are limited to 24 bits, the block size determines the maximum
# size of the COSS partition.  The default is 512 bytes, which
# leads to a maximum cache_dir size of 512<<24, or 8 GB.  Note
# you should not change the COSS block size after Squid
# has written some objects to the cache_dir.
#
# overwrite-percent=n defines the percentage of disk that COSS
# must write to before a given object will be moved to the
# current stripe.  A value of “n” closer to 100 will cause COSS
# to waste less disk space by having multiple copies of an object
# on disk, but will increase the chances of overwriting a popular
# object as COSS overwrites stripes.  A value of “n” close to 0
# will cause COSS to keep all current objects in the current COSS
# stripe at the expense of the hit rate.  The default value of 50
# will allow any given object to be stored on disk a maximum of
# 2 times.
#
# max-stripe-waste=n defines the maximum amount of space that COSS
# will waste in a given stripe (in bytes).  When COSS writes data
# to disk, it will potentially waste up to “max-size” worth of disk
# space for each 1MB of data written.  If “max-size” is set to a
# large value (ie >256k), this could potentially result in large
# amounts of wasted disk space. Setting this value to a lower value
# (ie 64k or 32k) will result in a COSS disk refusing to cache
# larger objects until the COSS stripe has been filled to within
# “max-stripe-waste” of the maximum size (1MB).
#
# membufs=n defines the number of “memory-only” stripes that COSS
# will use.  When an cache hit is performed on a COSS stripe before
# COSS has reached the overwrite-percent value for that object,
# COSS will use a series of memory buffers to hold the object in
# while the data is sent to the client.  This will define the maximum
# number of memory-only buffers that COSS will use.  The default value
# is 10, which will use a maximum of 10MB of memory for buffers.
#
# maxfullbufs=n defines the maximum number of stripes a COSS partition
# will have in memory waiting to be freed (either because the disk is
# under load and the stripe is unwritten, or because clients are still
# transferring data from objects using the memory).  In order to try
# and maintain a good hit rate under load, COSS will reserve the last
# 2 full stripes for object hits. (ie a COSS cache_dir will reject
# new objects when the number of full stripes is 2 less than maxfullbufs)
#
# The null store type:
#
# no options are allowed or required
#
# Common options:
#
# no-store, no new objects should be stored to this cache_dir
#
# min-size=n, refers to the min object size this storedir will accept.
# It’s used to restrict a storedir to only store large objects
# (e.g. aufs) while other storedirs are optimized for smaller objects
# (e.g. COSS). Defaults to 0.
#
# max-size=n, refers to the max object size this storedir supports.
# It is used to initially choose the storedir to dump the object.
# Note: To make optimal use of the max-size limits you should order
# the cache_dir lines with the smallest max-size value first and the
# ones with no max-size specification last.
#
# Note that for coss, max-size must be less than COSS_MEMBUF_SZ
# (hard coded at 1 MB).
#
#Default:
# cache_dir ufs c:/squid/var/cache 100 16 256
Hilangkan tanda # di depan cache_dir ufs c:/squid/var/cache 100 16 256. Ubah nilai 100. Contoh: cache_dir ufs c:/squid/var/cache 30720 16 256 (saya memasukkan nilai 30720, artinya kapasitas harddisk untuk cache squid sebesar 30720 MB atau sekitar 30 GB)
  • Cari TAG: cache_mem
Lihat kode berikut:
#  TAG: cache_mem       (bytes)
# NOTE: THIS PARAMETER DOES NOT SPECIFY THE MAXIMUM PROCESS SIZE.
# IT ONLY PLACES A LIMIT ON HOW MUCH ADDITIONAL MEMORY SQUID WILL
# USE AS A MEMORY CACHE OF OBJECTS. SQUID USES MEMORY FOR OTHER
# THINGS AS WELL. SEE THE SQUID FAQ SECTION 8 FOR DETAILS.
#
# ‘cache_mem’ specifies the ideal amount of memory to be used
# for:
# * In-Transit objects
# * Hot Objects
# * Negative-Cached objects
#
# Data for these objects are stored in 4 KB blocks.  This
# parameter specifies the ideal upper limit on the total size of
# 4 KB blocks allocated.  In-Transit objects take the highest
# priority.
#
# In-transit objects have priority over the others.  When
# additional space is needed for incoming data, negative-cached
# and hot objects will be released.  In other words, the
# negative-cached and hot objects will fill up any unused space
# not needed for in-transit objects.
#
# If circumstances require, this limit will be exceeded.
# Specifically, if your incoming request rate requires more than
# ‘cache_mem’ of memory to hold in-transit objects, Squid will
# exceed this limit to satisfy the new requests.  When the load
# decreases, blocks will be freed until the high-water mark is
# reached.  Thereafter, blocks will be used to store hot
# objects.
#
#Default:
# cache_mem 8 MB
Hilangkan tanda # di depan cache_mem 8 MB, dan ubah sizenya. Sebaiknya 1/3 dari size RAM komputer Anda. Contoh: cache_mem 1024 MB (saya menggunakan 1024 MB atau sekitar 1 GB untuk squid proxy)
  • Cari TAG: minimum_object_size
Lihat kode berikut:
#  TAG: minimum_object_size   (bytes)
# Objects smaller than this size will NOT be saved on disk.  The
# value is specified in kilobytes, and the default is 0 KB, which
#means there is no minimum.
#
#Default:
# minimum_object_size 0 KB
Hilangkan tanda # di depan minimum_object_size 0 KB. Sesuaikan sizenya. Contoh: minimum_object_size 1 KB. Artinya, minimal file yang akan disimpan ke dalam harddisk sebesar 1 KB.
  • Cari TAG: maximum_object_size
Lihat kode berikut:
#  TAG: maximum_object_size  (bytes)
# Objects larger than this size will NOT be saved on disk.  The
# value is specified in kilobytes, and the default is 4MB.  If
# you wish to get a high BYTES hit ratio, you should probably
# increase this (one 32 MB object hit counts for 3200 10KB
# hits).  If you wish to increase speed more than your want to
# save bandwidth you should leave this low.
#
# NOTE: if using the LFUDA replacement policy you should increase
# this value to maximize the byte hit rate improvement of LFUDA!
# See replacement_policy below for a discussion of this policy.
#
#Default:
# maximum_object_size 4096 KB
Hilangkan tanda # di depan maximum_object_size 4096 KB. Sesuaikan size untuk maksimal file yang akan disimpan ke dalam harddisk.
  • Cari TAG: maximum_object_size_in_memory
Lihat kode berikut:
#  TAG: maximum_object_size_in_memory        (bytes)
# Objects greater than this size will not be attempted to kept in
# the memory cache. This should be set high enough to keep objects
# accessed frequently in memory to improve performance whilst low
# enough to keep larger objects from hoarding cache_mem.
#
#Default:
# maximum_object_size_in_memory 8 KB
Hilangkan tanda # di depan maximum_object_size_in_memory 8 KB. Sesuaikan nilai untuk maksimal file yang tersimpan sementara di memory.
  • Simpan file konfigurasi yang telah kita buat diatas. Jalankan command prompt. Klik Start?Run?ketik cmd
  • Masuk ke direktori C:squidsbin dengan mengetikan perintah berikut cd C:squidsbin
  •  Ketik squid –z  [ enter]. Untuk membuat direktori swap/cache.
  • Ketik squid –d 1 –D  [enter]. Option “-d 1” digunakan untuk masuk ke debug level  (untuk diagnosa saja) dan option “-D” digunakan untuk membypass pengecekan DNS, berguna jika anda belum terkoneksi ke internet.
  • Ketik squid –i [enter]. Untuk memasukkan squid ke dalam service windows.
  • Ketik squid –O –D [enter]. Untuk memasukkan parameter –D ke registry ketika service dijalankan.
  • Jalankan service dengan cara Start => Run => services.msc => cari service dengan nama squid kemudian klik kanan pilih Start.
Untuk uninstall squid gunakan perintah squid –r [enter].
Selamat mencoba semoga berhasil.

8 comments:

arwanmegantara said...

gan kok kok FATAL : no port defined ya ?

Anonymous said...

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\ipoel_net>cd C:\squid\sbin

C:\squid\sbin>squid -z
2013/09/28 01:09:47| Creating Swap Directories

C:\squid\sbin>squid -d 1 -D
2013/09/28 01:10:11| Starting Squid Cache version 2.7.STABLE8 for i686-pc-winnt.
..
2013/09/28 01:10:11| Running on Windows XP
2013/09/28 01:10:11| Process ID 3840
2013/09/28 01:10:11| With 2048 file descriptors available
2013/09/28 01:10:11| With 512 CRT stdio descriptors available
2013/09/28 01:10:11| Windows sockets initialized
2013/09/28 01:10:11| Using select for the IO loop
2013/09/28 01:10:11| DNS Socket created at 0.0.0.0, port 2922, FD 4
2013/09/28 01:10:11| Adding nameserver 202.134.0.155 from squid.conf
2013/09/28 01:10:11| Adding nameserver 202.134.1.10 from squid.conf
2013/09/28 01:10:11| User-Agent logging is disabled.
2013/09/28 01:10:11| Referer logging is disabled.
2013/09/28 01:10:11| logfileOpen: opening log c:/squid/var/logs/access.log
2013/09/28 01:10:11| Unlinkd pipe opened on FD 7
2013/09/28 01:10:11| Swap maxSize 20971520 + 1048576 KB, estimated 1693853 objec
ts
2013/09/28 01:10:11| Target number of buckets: 84692
2013/09/28 01:10:11| Using 131072 Store buckets
2013/09/28 01:10:11| Max Mem size: 1048576 KB
2013/09/28 01:10:11| Max Swap size: 20971520 KB
2013/09/28 01:10:11| Local cache digest enabled; rebuild/rewrite every 3600/3600
sec
2013/09/28 01:10:11| logfileOpen: opening log c:/squid/var/logs/store.log
2013/09/28 01:10:11| Rebuilding storage in c:/squid/var/cache (DIRTY)
2013/09/28 01:10:11| Using Least Load store dir selection
2013/09/28 01:10:11| Set Current Directory to c:/squid/var/cache
2013/09/28 01:10:11| Loaded Icons.
2013/09/28 01:10:11| Accepting proxy HTTP connections at 0.0.0.0, port 3128, FD
13.
2013/09/28 01:10:11| Accepting ICP messages at 0.0.0.0, port 3130, FD 14.
2013/09/28 01:10:11| Accepting HTCP messages on port 4827, FD 15.
2013/09/28 01:10:11| Accepting SNMP messages on port 3401, FD 16.
2013/09/28 01:10:11| Ready to serve requests.
2013/09/28 01:10:11| Done reading c:/squid/var/cache swaplog (0 entries)
2013/09/28 01:10:11| Finished rebuilding storage from disk.
2013/09/28 01:10:11| 0 Entries scanned
2013/09/28 01:10:11| 0 Invalid entries.
2013/09/28 01:10:11| 0 With invalid flags.
2013/09/28 01:10:11| 0 Objects loaded.
2013/09/28 01:10:11| 0 Objects expired.
2013/09/28 01:10:11| 0 Objects cancelled.
2013/09/28 01:10:11| 0 Duplicate URLs purged.
2013/09/28 01:10:11| 0 Swapfile clashes avoided.
2013/09/28 01:10:11| Took 0.0 seconds ( 0.0 objects/sec).
2013/09/28 01:10:11| Beginning Validation Procedure
2013/09/28 01:10:11| Completed Validation Procedure
2013/09/28 01:10:11| Validated 0 Entries
2013/09/28 01:10:11| store_swap_size = 0k
2013/09/28 01:10:12| storeLateRelease: released 0 objects
ko cuma sampai di gan....?.uda g isa ljut lgi ke squid -i

Unknown said...

gan masalah sama dengan commentar diatas

Anonymous said...

sorry ada yg kurang setting mozila firefox manual proxy 127.0.0.1 port 1105 centang ceklistnya

Anonymous said...

soryitu tanda (+) jangan dipakai gan

Unknown said...

bisa minta tolong seting via teamviwer

Unknown said...
This comment has been removed by the author.
Unknown said...

cara agar cache otomatis tersimpan di folder yang berada di drive d: bagaimana gan. tolong pencerahannya gan....

Post a Comment


Followers

visitor of state

like me on FaceBook