RSS

Instalasi Server Hotspot pada Linux Ubuntu (Chillispot dan Freeradius)

Berikut ini adalah step by step instalasi server hotspot pada Ubuntu menggunakan Chillispot dan Freeradius. Langkah pertama yang terlebih dahulu dilakukan adalah menginstall linux ubuntu sesuai dengan kebutuhan dan memastikan ubuntu tersebut bekerja dengan baik.

- Konfigurasi IP Address di masing-masing Ethernet Card pada Server.
Misalnya pada server terdapat 3 Ethernet Card yaitu :
eth0 : untuk IP Address Public,
eth1 : untuk IP address lokal atau intranet, dan
eth2 : tunnel interface yang digunakan oleh Chillispot.

File Konfigurasi IP Address pada ubuntu terletak pada /etc/network/interfaces, berikut contoh konfigurasinya :

auto eth0
iface eth0 inet static
address 77.67.76.10
netmask 255.255.255.240
gateway 77.67.76.1

auto eth1
iface eth1 inet static
address 192.168.12.25
netmask 255.255.255.224

- Setting IP DNS yang diberikan oleh pihak ISP maupun IP DNS Lokal/intranet.
File konfigurasi terletak pada /etc/resolv.conf, berikut contoh konfigurasinya :

domain example.ac.id
namserver 202.155.0.10
atau
domain example.ac.id
nameserver 192.168.12.10

- Mengaktifkan IP Forwading, sehingga Server berfungsi sebagai gateway dan mampu meneruskan paket data.
File konfigurasi terletak pada /etc/sysctl.conf, hilangkan tanda ‘ # ’ pada baris net.ipv4.conf.default.forwarding=1.

Awalnya seperti ini :
#net.ipv4.conf.default.forwarding=1
Menjadi :
net.ipv4.conf.default.forwarding=1

- Reboot & Pastikan semua konfigurasi berjalan dengan baik, jalankan PING dan NSLOOKUP untuk mengetahui apakah server sudah terhubung ke jaringan intranet maupun internet.

Langkah selanjutya adalah instalasi paket-paket yang dibutuhkan pada server Hotspot, diantaranya :
> Apache Web Server
> Mysql Database Server
> PHP
> SSL Certificate
> Freeradius, dan
> Chillispot

Untuk melakukan instalasi paket-paket yang dibutuhkan pada server, cukup dengan menggunakan sintaks apt-get install, berikut sintaks lengkapnya :

apt-get install apache2 php5 mysql-server libapache2-php5 php5-mysql ssl-cert freeradius freeradius-mysql chillispot

Pada saat instalasi paket, khususnya pada proses instalasi mysql server, Anda akan diminta untuk memasukkan password root mysql yang dikehendaki. Jika anda tidak dimintai untuk memasukkan password atau Anda mengabaikannya, Anda dapat membuatnya dengan perintah:

mysqladmin -u root password ’rahasiabanget’

Begitu juga dengan proses instalasi paket-paket yang lain, jika diminta untuk memasukkan konfigurasi tertentu Anda dapat mengabaikannya. Konfigurasi dapat dilakukan setelah proses instalasi.

- Konfigurasi Apache Web Server
File konfigurasi terletak pada /etc/apache2/apache2.conf, berikut contoh konfigurasi sederhana pada file apache2.conf :

Masukkan baris seperti dibawah ini,
ServerName hotspot.example.ac.id
atau
ServerName 192.168.12.25

Restart apache untuk me-reload konfigurasi:

/etc/init.d/apache2 restart

- Konfigurasi SSL pada Web Server
SSL digunakan oleh chillispot untuk menampilkan halaman otentikasi, Berikut dipaparkan langkah-langkah untuk mengaktifkan modul SSL pada Web Server :

# cd /etc/apache2/site-available/

copy file default-ssl menjadi ssl file pada direktory diatas
# cd /etc/apache2

buat direktory baru dengan nama ssl
# cd /etc/apache2/ssl

buat certificate apache.pem
# make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
# vi /etc/apache2/site-available/ssl
cari tulisan berikut:
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
dan ganti dengan
SSLCertificateFile /etc/apache2/ssl/apache.pem

Mengaktifkan module ssl
# a2enmod ssl

Mengaktifkan site ssl dengan nama file ssl
# a2ensite ssl

Restart /reload apache, cek dengan perintah https://example.ac.id

- Konfigurasi Chillispot
File Konfigurasi terletak pada /etc/chilli.conf, berikut contoh konfigurasinya :

#—/etc/chilli.conf—
net 172.16.20.0/24
dns1 192.168.12.10
dns2 192.168.12.10
radiusserver1 127.0.0.1
radiusserver2 127.0.0.1
radiussecret rahasiabanget
dhcpif eth2
uamserver https://172.16.20.1/cgi-bin/hotspotlogin.cgi
uamsecret rahasiabangetjuga
uamlisten 172.16.20.1

Keterangan:
> net, mendefinisikan network yang akan digunakan oleh chillispot sebagai penyedia IP Address untuk pengguna hotspot.
> radiussecret, digunakan oleh chillispot untuk berkomunikasi dengan server radius yang didefinisikan pada radiusserver1 maupun radiusserver2.
> dhcpif, interface yang digunakan sebagai tunnel interface oleh chillispot.
> uamserver, mengarah kepada hotspotlogin.cgi sebagai otentikasi user ketika menggunakan layanan hotspot URL menggunakan https untuk enkripsi data.
> uamsecret, digunakan oleh chillispot untuk berkomunikasi dengan uamserver.
> uamlisten, IP address pada tunnel Interface yang didefinisikan pada dhcpif.

- Konfigurasi hotspotlogin.cgi
File awal terletak pada direktori /usr/share/doc/chillispot/. Jika file masih terbungkus dalam bentuk file archieve seperti hotspotlogin.cgi.gz maka ekstrak terlebih dahulu, baru kemudian di-copy menuju direktori /usr/lib/cgi-bin/.

# cd /usr/share/doc/chillispot
# ls
hotspotlogin.cgi.gz
# gunzip hotspotlogin.cgi.gz
# ls
hotspotlogin.cgi.gz hotspotlogin.cgi
# cp hotspotlogin.cgi /usr/lib/cgi-bin/
# cd /usr/lib/cgi-bin/
# chmod 755 hotspotlogin.cgi

Edit file hotspotlogin.cgi dan cari baris $uamsecret dan $userpassword, jika ada tanda ‘ # ’ pada baris tersebut maka hapuslah.

$userpassword = 1;
$uamsecret = “rahasiabangetjuga”; (disesuaikan dengan chilli.conf)

Beberapa file yang harus dikonfigurasi pada paket Freeradius diantaranya :
> /etc/freeradius/clients.conf
> /etc/freeradius/radiusd.conf
> /etc/freeradius/sql.conf
> /etc/freeradius/sites-enabled/default

- Konfigurasi clients.conf
Konfigurasi pada clients.conf pada initinya adalah mendefinisikan server chillispot yang terhubung dengan freeradius, pada tulisan ini server chillispot maupun freeradius tergabung dalam satu server. Berikut adalah contoh konfigurasinya :

#—clients.conf—
client localhost {
ipaddr = 127.0.0.1
secret = rahasiabanget (disesuaikan dengan chilli.conf)
nastype = other
}
Misal server chillispot terpisah dengan Freeradius:
#—clients.conf—
client 192.168.12.22/32 {
secret = rahasiabanget (disesuaikan dengan konfigurasi pada 192.168.12.22)
shortname = ddwrt
}

- Konfigurasi radiusd.conf
File radiusd.conf merupakan file konfigurasi utama yang menggabungkan file-file konfigurasi terpisah seperti clients.conf, sql.conf, dan modul-modul yang dibutuhkan oleh server freeradius.
- Konfigurasi sql.conf
Agar freeradius dapat terhubung dengan mysql, maka perlu mendefinisikan server mysql yang digunakan beserta user dan password yang mempunyai privillage pada database freeradius. Hanya ada beberapa baris konfigurasi yang disesuaikan, diantaranya :

#—sql.conf—
server = “localhost”;
login = “root”; (disarankan untuk tidak menggunakan user root)
password = “rahasia”;
radius_db = “nama_database”;

- Konfigurasi sites-enabled/default
Untuk mengaktifkan modul-modul pada freeradius dan dalam pembahasan ini adalah modul mysql, file konfigurasi terletak pada /etc/freeradius/sites-enabled/default. Hilangkan tanda ‘ # ’ pada setiap baris yang mengandung kata ‘ sql ’ .

authorize {


sql
noresetcounter (sesuaikan dengan /etc/freeradius/sql/mysql/counter.conf)

}

accounting {


sql
sql_log


}

session {

sql

}

post-auth {


sql
sql_log

}

- Menambahkan database radius pada mysql
Dalam paket instalasinya freeradius telah menyediakan struktur database standard dari freeradius itu sendiri yaitu pada file /etc/freeradius/sql/mysql/schema.sql. Jika Anda ingin menggunakan Struktur database yang disediakan dari Freeradius berikut langkah-langkahnya :

# cd /etc/freeradius/sql/mysql/
# mysql –u user –p nama_database < schema.sql

Jika Anda menggunakan database dari PhpMyPrepaid (Web Portal), importing database standar freeradius diatas tidak digunakan.

- Instalasi PhpMyPrepaid
Paket phpmyprepaid yang digunakan pada tutorial ini adalah phpmyprepaid0.3.3.tgz, paket tersebut dapat langsung didownload dari http://sourceforge.net/projects/phpmyprepaid/files/.
Kita asumsikan file phpmyprepaid0.3.3.tgz telah didownload dan berada pada direktori web server yaitu /var/www.

# cd /var/www
# ls
index.html phpmyprepaid0.3.3.tgz

Ektrak file phpmyprepaid0.3.3.tgz
# tar –xzvf phpmyprepaid0.3.3.tgz
# ls
index.html phpmyprepaid0.3.3.tgz phpmyprepaid0.3.3
# mv phpmyprepaid0.3.3 prepaid

Sebelum melanjutkan instalasi phpmyprepaid, terlebih dahulu membuat database yang akan digunakan phpmyprepaid pada Mysql. Misalnya : test.

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 85
Server version: 5.1.41-3ubuntu12.6 (Ubuntu)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> create database test;
Query OK, 1 row affected (0.00 sec)

mysql> exit
Bye

Kembali ke instalasi phpmyprepaid, buka browser dan ketikkan

http://example.ac.id/prepaid

Pada General Configuration for Mysql,
Server : localhost
User name : root (tidak disarankan menggunakan root)
Password : ********
Database name : test (contoh database yang dgunakan oleh prepaid)

Klik tombol Save Configuration, dan akan muncul halaman seperti dibawah ini.

Phpmyprepaid akan membuat table sendiri, dan kita akan diminta untuk memasukkan user dan password untuk login sebagai admin pada phpmyprepaid.

Login dengan menggunakan Username dan Password yang telah anda inputkan pada proses sebelumnya.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Setting Radius Manager Mikrotik

klik 2x pada hsprof1
Pilih tab Login, hilangkan centang pada Cookies, lalu klik Apply


Pilih tab Radius, centang Use Radius lalu klik OK

Setting Radius

Pilih menu Radius

Setting User Manager

Kembali ke Menu Utama, pilih Menu New Terminal
Pada Terminal ketik (nantinya digunakan untuk login ke usermanager) :
[admin@MikroTik] > /tool user-manager customer add login=admin password=passw0rd permission=owner
Masih pada Terminal ketik lagi :
[admin@MikroTik] > /tool user-manager router add subscriber=admin ip-address=127.0.0.1 shared-secret=12345

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Installing Apache2 With PHP5 And MySQL Support On Ubuntu 10.10 (LAMP)

LAMP is short for Linux, Apache, MySQL, PHP. This tutorial shows how you can install an Apache2 webserver on an Ubuntu 10.10 server with PHP5 support (mod_php) and MySQL support.

I do not issue any guarantee that this will work for you!

1 Preliminary Note

In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.

I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:

sudo su

2 Installing MySQL 5

First we install MySQL 5 like this:

aptitude install mysql-server mysql-client

You will be asked to provide a password for the MySQL root user - this password is valid for the user root@localhost as well as root@server1.example.com, so we don't have to specify a MySQL root password manually later on:

New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword

3 Installing Apache2

Apache2 is available as an Ubuntu package, therefore we can install it like this:

aptitude install apache2

Now direct your browser to http://192.168.0.100, and you should see the Apache2 placeholder page (It works!):

Apache's default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d.

4 Installing PHP5

We can install PHP5 and the Apache PHP5 module as follows:

aptitude install php5 libapache2-mod-php5

We must restart Apache afterwards:

/etc/init.d/apache2 restart


5 Testing PHP5 / Getting Details About Your PHP5 Installation

The document root of the default web site is /var/www. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.

vi /var/www/info.php

     

Now we call that file in a browser (e.g. http://192.168.0.100/info.php):

As you see, PHP5 is working, and it's working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don't have MySQL support in PHP5 yet.

6 Getting MySQL Support In PHP5

To get MySQL support in PHP, we can install the php5-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

aptitude search php5

Pick the ones you need and install them like this:

aptitude install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json

Now restart Apache2:

/etc/init.d/apache2 restart

Now reload http://192.168.0.100/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:

7 phpMyAdmin

phpMyAdmin is a web interface through which you can manage your MySQL databases. It's a good idea to install it:

aptitude install phpmyadmin

You will see the following questions:

Web server to reconfigure automatically: <-- apache2
Configure database for phpmyadmin with dbconfig-common? <-- No

Afterwards, you can access phpMyAdmin under http://192.168.0.100/phpmyadmin/:

8 Links

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

Proxy Ubuntu server 10.10 dengan squid 2.7

Barusan dapat dari Forum Mikrotik, Setting Proxy Ubuntu server 10.10 64 bit, dengan menggunakan squid 2.7 stable 9 Whith pacth video cache, lumayan bisa cache video youtube dan yang pasti sudah saya test kehebatannya di warnet yang saya kelola , ok kita langsung saja ;

Speck yang saya gunakan:
HD 80 Gb sata
Prosessor intel pentium 4.3
ram 1 Gb ddr 2

Langkah demi langkah ;
  1. bebaskan semua hubungan ke cpu ke internet
  2. masukkan CD ubuntu ke dalam CD room laku lakukan reboot untuk memulai booting via CD room
  3. pilih linguage english ( enter )
  4. pilih instal ubuntu server ( enter )
  5. tekan enter pada chaoos linguage english
  6. pilih united states
  7. klik no pada detect keyboard layout
  8. kilk USA pada ubuntu installer main menu
  9. klik USA pada keyboard layout
  10. klik continue pada configuere the network
  11. pilih configure network manually dan isikan ip address dengan 192.168.1.10( ip untuk proxy ) pilih continue lalu enter
  12. netmark 255.255.255.0 pilih continue enter
  13. gatway 192.168.1.1 terus kilk continue
  14. name server address 192.168.1.1 pilih continue enter
  15. hostname : isi dengan proxyku terus pilih continue enter
  16. domain name di kosongin saja, pilih continue enter
  17. pada configure the clock pilih select worldwide list terus cari jakarta kemudian enter
  18. Pada menu partition disk pilih manual
  19. Kita hapus partisi lama dulu :
  20. Pilih partisi nya terus enter pilih delete the partion (ulangi perintah ini untuk semua partisi yg tersisa)
  21. Jika telah selesai pilih Guided partitioning, kemudian pilih manual arahkan pada FREE SPACE (enter),
  22. Pilih Create new partition (enter)
  23. New partition size isi 20 GB/40% dari hardisc (pilih continue dan enter), pilih Primary (enter), pilih Beginning (enter), pada use as pilih EXT4 (enter) pada Mount point pilih / (enter), pd mount option pilih[*] noatime (pilih continue dan enter), kemudian pilih done setting up the partition
  24. Arahkan pada FREE SPACE (enter), pilih Create new partition (enter) new partition size isi 1 gb sesuai kan dg besaran RAM (pilih continue dan enter), pilih Primary (enter), pilih Beginning (enter), pada use as pilih swap area (enter), kemudian Pilih done setting up the partition
  25. Arahkan pada FREE SPACE (enter),
    pilih Create new partition (enter) new partition size isi sisa semua harddisk (pilih continue dan enter), pilih Primary (enter), pilih Beginning (enter), pada use as pilih btrFS (enter), pada Moun point enter manually buat menjadi /cache, pd mount option pilih[*] noatime kemudian Pilih continue dan done setting up the partition
  26. Kemudian pilih finis partitioning and write changes to disk, write the changes to disk pilih yes
  27. pada full name for the new user isi dg proxyku, terus continue & enter
  28. pada Username for your account isi dg proxyku, terus continue & enter
  29. pada a password for the new user isi dg proxyku, terus continue & enter
  30. pada re-enter password to verify isi dg proxyku, terus continue & enter
  31. pada use weak password pilih yes
  32. pada encrypt your home directory pilih no
  33. pada HTTP proxy information KOSONGIN SAJA
  34. pada configurasi apt 43% tekan enter ( untuk Skip biar cpt ), juga pada 81% ( untuk Skip biar cpt )tekan enter
    pilih no automatic update
  35. pada choose software to install pilih OpenSSH server
    pilih continus pd finis the installation dan restart

Install Paket yg di butuhkan ( CPU harap di hubungkan ke Internet)
mulai bekerja menggunakan putty via windows ok siapkan puttynya di windows
# login ke proxy via putty
# masukkan username proxyku
# password proxyku
# ketik sudo su
# ketik passwd proxyku
sekarang kita mulai bekerja pada tahap penginstallan
# Lakukan update apt-get di bawah ini ;

sudo apt-get update
sudo apt-get install squid squidclient squid-cgi
sudo apt-get install gcc
sudo apt-get install build-essential
sudo apt-get install sharutils
sudo apt-get install ccze
sudo apt-get install libzip-dev
sudo apt-get install automake1.9

# Download Squid 7 Stable 9 di sini :
wget http://untuk-kamu.googlecode.com/files/squid-2.7.STABLE9%2Bpatch.tar.gz
tar xvf squid-2.7.STABLE9+patch.tar.gz
cd squid-2.7.STABLE9

# lakukan tahap compile nya :
./configure --prefix=/usr --exec_prefix=/usr --bindir=/usr/sbin --sbindir=/usr/sbin --libexecdir=/usr/lib/squid --sysconfdir=/etc/squid \
--localstatedir=/var/spool/squid --datadir=/usr/share/squid --enable-async-io=24 --with-aufs-threads=24 --with-pthreads --enable-storeio=aufs \
--enable-linux-netfilter --enable-arp-acl --enable-epoll --enable-removal-policies=heap --with-aio --with-dl --enable-snmp \
--enable-delay-pools --enable-htcp --enable-cache-digests --disable-unlinkd --enable-large-cache-files --with-large-files \
--enable-err-languages=English --enable-default-err-language=English --with-maxfd=65536
Kemudia:
make
sudo make install

sampai disini squid sudah terinstal di mesin proxy ok Lanjut..yukk ....

Siap pengEditan Squid.conf
#Stop Squid sudo /etc/init.d/squid stop
agar perintah sudo /etc/init.d/squid stop jalan di ubuntu 10.10,
Copy file squid di bawah ini ke /etc/init.d/
caranya ketik :

nano /etc/init.d/squid


PASTE FILE DI BAWAH INI
#! /bin/sh
#
# squid Startup script for the SQUID HTTP proxy-cache.
#
# Version: @(#)squid.rc 2.20 01-Oct-2001 miquels@cistron.nl
#
### BEGIN INIT INFO
# Provides: squid
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: $named
# Should-Stop: $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Squid HTTP Proxy
### END INIT INFO


NAME=squid
DAEMON=/usr/sbin/squid
LIB=/usr/lib/squid
PIDFILE=/var/run/$NAME.pid
SQUID_ARGS="-D -YC"


[ ! -f /etc/default/squid ] || . /etc/default/squid


. /lib/lsb/init-functions


PATH=/bin:/usr/bin:/sbin:/usr/sbin


[ -x $DAEMON ] || exit 0


grepconf () {
w=" " # space tab
sq=/etc/squid/squid.conf
# sed is cool.
res=`sed -ne '
s/^'$1'['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
t end;
d;
:end q' < $sq`
[ -n "$res" ] || res=$2
echo "$res"
}
setelah selesai tekan crtl+x kemudian yes,
ok file /etc/init.d/squid sudah kita bikin, agar file yg kita bikin tadi bisa bekerja maka kita harus memberikan permisi direktory pada file tersebut dengan perintah:

chown proxy:proxy /etc/init.d/squid
chmod 777 /etc/init.d/squid
sekarang proxy sudah bisa di stop dengan perintah
sudo /etc/init.d/squid stop
bila sudah di stop, saatnya kita mengedit squid.conf nya... caranya
1. beck up file asli squid.conf dengan perintah
mv /etc/squid/squid.conf /etc/squid/squid.conf.asli
2. Creat config squid baru
nano /etc/squid/squid.conf
Lalu paste dan sesuaikan dengan network anda file config squid di bawah


##start of config
http_port 3128 transparent
server_http11 on
icp_port 0

# File Squid
pid_filename /var/run/squid.pid
coredump_dir /var/spool/squid/
error_directory /usr/share/squid/errors/en/
icon_directory /usr/share/squid/icons
mime_table /usr/share/squid/mime.conf
visible_hostname beben-dayak

# Log Squid
access_log /var/log/squid/access.log
cache_log /dev/null
cache_store_log /dev/null

# Beberapa log yg tidak signifikan karena opsi2-nya jarang digunakan.
log_fqdn off
log_icp_queries off
buffered_logs off
emulate_httpd_log off

ftp_list_width 32
ftp_passive on
ftp_sanitycheck on

acl localnet src 192.168.10.0/24 # ------ >> GANTI DGN IP LAN JURAGAN
acl localnet src 192.168.12.0/24
uri_whitespace strip

#DNS NAMESERVER
dns_nameservers 192.168.1.1 192.168.5.1 # ------->> GANTI DG GATEWAI PROXY NYA

cache_mem 8 MB
maximum_object_size_in_memory 100 bytes
memory_replacement_policy heap GDSF
cache_replacement_policy heap LFUDA

cache_dir aufs /cache 30000 70 256

minimum_object_size 0 bytes
maximum_object_size 512 MB
offline_mode off
cache_swap_low 98
cache_swap_high 99

# Setup some default acls
acl all src 0.0.0.0/0
acl localhost src 127.0.0.1/32
acl safeports port 21 70 80 81 210 280 443 488 563 591 631 777 901 3128 1025-65535
acl sslports port 443 563 81
acl manager proto cache_object
acl purge method PURGE
acl connect method CONNECT
acl dynamic urlpath_regex cgi-bin \?
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
# Always allow localhost connections
http_access allow localhost

# Allow local network(s) on interface(s)
http_access allow localnet

# Default block all to be sure
http_access deny all
header_access X-Forwarded-For deny all
#follow_x_forwarded_for allow localnet
#follow_x_forwarded_for allow localhost
#http_gzip on
#http_gzip_types text/plain,text/html,text/xml,text/css,application/xml,application/xhtml+xml,application/rss+xml,application/javascript,application/x-javascript

tcp_outgoing_tos 0x30 localnet
zph_mode tos
zph_local 0x30
zph_parent 0
zph_option 136

# DELAY POLL

#acl admin src 192.168.88.100/32 # IP YG TDK KENA LIMIT
#acl management src 192.168.88.101/32 # IP YG TIDAK KENA LIMIT

#acl download url_regex -i \.avi$ \.mpg$ \.mpeg$ \.rm$ \.iso$ \.wav$ \.mov$ \.dat$ \.mpe$ \.mid$ \.flv$ \.3gp$
#acl download url_regex -i ftp \.exe$ \.mp3$ \.mp4$ \.tar.gz$ \.gz$ \.tar.bz2$ \.rpm$ \.zip$ \.rar$
#acl download url_regex -i \.midi$ \.rmi$ \.wma$ \.wmv$ \.ogg$ \.ogm$ \.m1v$ \.mp2$ \.mpa$ \.wax$
#acl download url_regex -i \.m3u$ \.asx$ \.wpl$ \.wmx$ \.dvr-ms$ \.snd$ \.au$ \.aif$ \.asf$ \.m2v$
#acl download url_regex -i \.m2p$ \.ts$ \.tp$ \.trp$ \.div$ \.divx$ \.mod$ \.vob$ \.aob$ \.dts$
#acl download url_regex -i \.ac3$ \.cda$ \.vro$ \.deb$ \.mkv$

#delay_pools 2

#delay_class 1 1
#delay_parameters 1 -1/-1
#delay_access 1 allow admin
#delay_access 1 allow admin management
#delay_access 1 deny all

#delay_class 2 1
#delay_parameters 2 40000/5000000
#delay_access 2 allow download
#delay_access 2 deny all

# Caching Youtube
acl videocache_allow_url url_regex -i \.youtube\.com\/get_video\?
acl videocache_allow_url url_regex -i \.youtube\.com\/videoplayback \.youtube\.com\/videoplay \.youtube\.com\/get_video\?
acl videocache_allow_url url_regex -i \.youtube\.[a-z][a-z]\/videoplayback \.youtube\.[a-z][a-z]\/videoplay \.youtube\.[a-z][a-z]\/get_video\?
acl videocache_allow_url url_regex -i \.googlevideo\.com\/videoplayback \.googlevideo\.com\/videoplay \.googlevideo\.com\/get_video\?
acl videocache_allow_url url_regex -i \.google\.com\/videoplayback \.google\.com\/videoplay \.google\.com\/get_video\?
acl videocache_allow_url url_regex -i \.google\.[a-z][a-z]\/videoplayback \.google\.[a-z][a-z]\/videoplay \.google\.[a-z][a-z]\/get_video\?
acl videocache_allow_url url_regex -i proxy[a-z0-9\-][a-z0-9][a-z0-9][a-z0-9]?\.dailymotion\.com\/
acl videocache_allow_url url_regex -i vid\.akm\.dailymotion\.com\/
acl videocache_allow_url url_regex -i [a-z0-9][0-9a-z][0-9a-z]?[0-9a-z]?[0-9a-z]?\.xtube\.com\/(.*)flv
acl videocache_allow_url url_regex -i \.vimeo\.com\/(.*)\.(flv|mp4)
acl videocache_allow_url url_regex -i va\.wrzuta\.pl\/wa[0-9][0-9][0-9][0-9]?
acl videocache_allow_url url_regex -i \.youporn\.com\/(.*)\.flv
acl videocache_allow_url url_regex -i \.msn\.com\.edgesuite\.net\/(.*)\.flv
acl videocache_allow_url url_regex -i \.tube8\.com\/(.*)\.(flv|3gp)
acl videocache_allow_url url_regex -i \.mais\.uol\.com\.br\/(.*)\.flv
acl videocache_allow_url url_regex -i \.blip\.tv\/(.*)\.(flv|avi|mov|mp3|m4v|mp4|wmv|rm|ram|m4v)
acl videocache_allow_url url_regex -i \.break\.com\/(.*)\.(flv|mp4)
acl videocache_allow_url url_regex -i redtube\.com\/(.*)\.flv
acl videocache_allow_dom dstdomain .mccont.com .metacafe.com .cdn.dailymotion.com
acl videocache_deny_dom dstdomain .download.youporn.com .static.blip.tv
acl dontrewrite url_regex redbot\.org \.php
acl getmethod method GET

storeurl_access deny dontrewrite
storeurl_access deny !getmethod
storeurl_access deny videocache_deny_dom
storeurl_access allow videocache_allow_url
storeurl_access allow videocache_allow_dom
storeurl_access deny all

storeurl_rewrite_program /etc/squid/storeurl.pl
storeurl_rewrite_children 7
storeurl_rewrite_concurrency 10

# 1 year = 525600 mins, 1 month = 43200 mins, 1 day = 1440

refresh_pattern (get_video\?|videoplayback\?|videodownload\?|\.flv?) 43200 999999% 43200 ignore-no-cache ignore-no-store ignore-private override-expire override-lastmod reload-into-ims store-stale
refresh_pattern (get_video\?|videoplayback\?id|videoplayback.*id|videodownload\?|\.flv?) 43200 999999% 43200 ignore-no-cache ignore-no-store ignore-private override-expire override-lastmod reload-into-ims store-stale
refresh_pattern \.(ico|video-stats) 43200 999999% 43200 override-expire ignore-reload ignore-no-cache ignore-no-store ignore-private ignore-auth override-lastmod ignore-must-revalidate negative-ttl=10080 store-stale
refresh_pattern \.etology\? 43200 999999% 43200 override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern galleries\.video(\?|sz) 43200 999999% 43200 override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern brazzers\? 43200 999999% 43200 override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern \.adtology\? 43200 999999% 43200 override-expire ignore-reload ignore-no-cache store-stale
refresh_pattern ^.*(utm\.gif|ads\?|rmxads\.com|ad\.z5x\.net|bh\.contextweb\.com|bstats\.adbrite\.com|a1\.interclick\.com|ad\.trafficmp\.com|ads\.cubics\.com|ad\.xtendmedia\.com|\.googlesyndication\.com|advertising\.com|yieldmanager|game-advertising\.com|pixel\.quantserve\.com|adperium\.com|doubleclick\.net|adserving\.cpxinteractive\.com|syndication\.com|media.fastclick.net).* 43200 20% 43200 ignore-no-cache ignore-no-store ignore-private override-expire ignore-reload ignore-auth ignore-must-revalidate store-stale negative-ttl=40320 max-stale=10
refresh_pattern ^.*safebrowsing.*google 43200 999999% 43200 override-expire ignore-reload ignore-no-cache ignore-private ignore-auth ignore-must-revalidate negative-ttl=10080 store-stale
refresh_pattern ^http://((cbk|mt|khm|mlt)[0-9]?)\.google\.co(m|\.uk) 43200 999999% 43200 override-expire ignore-reload ignore-private store-stale negative-ttl=10080
refresh_pattern ytimg\.com.*\.jpg 43200 999999% 43200 override-expire ignore-reload store-stale
refresh_pattern images\.friendster\.com.*\.(png|gif) 43200 999999% 43200 override-expire ignore-reload store-stale
refresh_pattern garena\.com 43200 999999% 43200 override-expire reload-into-ims store-stale
refresh_pattern photobucket.*\.(jp(e?g|e|2)|tiff?|bmp|gif|png) 43200 999999% 43200 override-expire ignore-reload store-stale
refresh_pattern vid\.akm\.dailymotion\.com.*\.on2\? 43200 999999% 43200 ignore-no-cache override-expire override-lastmod store-stale
refresh_pattern mediafire.com\/images.*\.(jp(e?g|e|2)|tiff?|bmp|gif|png) 43200 999999% 43200 reload-into-ims override-expire ignore-private store-stale
refresh_pattern ^http:\/\/images|pics|thumbs[0-9]\. 43200 999999% 43200 reload-into-ims ignore-no-cache ignore-no-store ignore-reload override-expire store-stale
refresh_pattern ^http:\/\/www.onemanga.com.*\/ 43200 999999% 43200 reload-into-ims ignore-no-cache ignore-no-store ignore-reload override-expire store-stale
refresh_pattern ^http://v\.okezone\.com/get_video\/([a-zA-Z0-9]) 43200 999999% 43200 override-expire ignore-reload ignore-no-cache ignore-no-store ignore-private ignore-auth override-lastmod ignore-must-revalidate negative-ttl=10080 store-stale

# ANTI VIRUS
refresh_pattern avast.com.*\.vpx 40320 50% 161280 store-stale reload-into-ims
refresh_pattern (avgate|avira).*\.(idx|gz)$ 1440 90% 1440 ignore-reload ignore-no-cache ignore-no-store store-stale ignore-must-revalidate
refresh_pattern kaspersky.*\.avc$ 5259487 999999% 5259487 ignore-reload store-stale
refresh_pattern kaspersky 1440 50% 161280 ignore-no-cache store-stale
refresh_pattern mbamupdates.com.*\.ref 1440 50% 161280 reload-into-ims store-stale

refresh_pattern windowsupdate.com/.*\.(cab|exe) 10080 999999% 43200 ignore-no-cache ignore-no-store ignore-reload reload-into-ims store-stale
refresh_pattern update.microsoft.com/.*\.(cab|exe) 10080 999999% 43200 ignore-no-cache ignore-no-store ignore-reload reload-into-ims store-stale
refresh_pattern download.microsoft.com/.*\.(cab|exe) 10080 999999% 43200 ignore-no-cache ignore-no-store ignore-reload reload-into-ims store-stale

#images facebook
refresh_pattern -i \.facebook.com.*\.(jpg|png|gif) 129600 999999% 129600 ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
refresh_pattern -i \.fbcdn.net.*\.(jpg|gif|png|swf|mp3) 129600 999999% 129600 ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
refresh_pattern static\.ak\.fbcdn\.net*\.(jpg|gif|png) 129600 999999% 129600 ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
refresh_pattern ^http:\/\/profile\.ak\.fbcdn.net*\.(jpg|gif|png) 129600 999999% 129600 ignore-reload override-expire ignore-no-cache ignore-no-store store-stale

# games facebook
refresh_pattern ^http:\/\/apps.facebook.com.*\/ 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
refresh_pattern -i \.zynga.com.*\/ 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-must-revalidate store-stale
refresh_pattern -i \.farmville.com.*\/ 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-must-revalidate store-stale
refresh_pattern -i \.ninjasaga.com.*\/ 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-must-revalidate store-stale
refresh_pattern -i \.mafiawars.com.*\/ 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-must-revalidate store-stale
refresh_pattern -i \.crowdstar.com.*\/ 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-must-revalidate store-stale
refresh_pattern -i \.popcap.com.*\/ 10080 999999% 43200 ignore-reload override-expire ignore-no-cache ignore-no-store ignore-must-revalidate store-stale

#banner IIX
refresh_pattern ^http:\/\/openx.*\.(jp(e?g|e|2)|gif|pn[pg]|swf|ico|css|tiff?) 129600 99999% 129600 reload-into-ims ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
refresh_pattern ^http:\/\/ads(1|2|3).kompas.com.*\/ 43200 99999% 129600 reload-into-ims ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
refresh_pattern ^http:\/\/img.ads.kompas.com.*\/ 43200 99999% 129600 reload-into-ims ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
refresh_pattern .kompasimages.com.*\.(jpg|gif|png|swf) 43200 99999% 129600 reload-into-ims ignore-reload override-expire ignore-no-cache ignore-no-store store-stale
refresh_pattern ^http:\/\/openx.kompas.com.*\/ 43200 99999% 129600 reload-into-ims ignore-reload override-expire ignore-no-cache ignore-no-store store-stale

#IIX DOWNLOAD
refresh_pattern ^http:\/\/\.www[0-9][0-9]\.indowebster\.com\/(.*)(mp3|rar|zip|flv|wmv|3gp|mp(4|3)|exe|msi|zip) 43200 99999% 129600 reload-into-ims ignore-reload override-expire ignore-no-cache ignore-no-store store-stale ignore-auth

#All File
#refresh_pattern -i \.(3gp|7z|ace|asx|bin|deb|divx|dvr-ms|ram|rpm|exe|inc|cab|qt) 43200 999999% 43200 ignore-no-cache ignore-no-store ignore-must-revalidate override-expire override-lastmod reload-into-ims store-stale
#refresh_pattern -i \.(rar|jar|gz|tgz|bz2|iso|m1v|m2(v|p)|mo(d|v)|arj|lha|lzh|zip|tar) 43200 999999% 43200 ignore-no-cache ignore-no-store ignore-must-revalidate override-expire override-lastmod reload-into-ims store-stale
#refresh_pattern -i \.(jp(e?g|e|2)|gif|pn[pg]|bm?|tiff?|ico|swf|dat|ad|txt|dll) 43200 999999% 43200 ignore-no-cache ignore-no-store ignore-must-revalidate override-expire override-lastmod reload-into-ims store-stale
#refresh_pattern -i \.(avi|ac4|mp(e?g|a|e|1|2|3|4)|mk(a|v)|ms(i|u|p)|og(x|v|a|g)|rm|r(a|p)m|snd|vob) 43200 999999% 43200 ignore-no-cache ignore-no-store ignore-must-revalidate override-expire override-lastmod reload-into-ims store-stale
#refresh_pattern -i \.(pp(t?x)|s|t)|pdf|rtf|wax|wm(a|v)|wmx|wpl|cb(r|z|t)|xl(s?x)|do(c?x)|flv|x-flv) 43200 999999% 43200 ignore-no-cache ignore-no-store ignore-must-revalidate override-expire override-lastmod reload-into-ims store-stale

#refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
#refresh_pattern ^gopher: 1440 0% 1440
#refresh_pattern ^ftp: 10080 95% 43200 override-lastmod reload-into-ims store-stale
#refresh_pattern . 00 95% 43200 override-lastmod reload-into-ims store-stale

emulate_httpd_log off
hosts_file /etc/hosts

### Objek-objek statis waktu peyimpanannya diperlama
refresh_pattern -i \.(class|css|js|tif)(\?.*)?$ 1440 95% 100000080 reload-into-ims override-lastmod
refresh_pattern -i \.(jpe|jpg|jpeg|png|bmp|gif)(\?.*)?$ 0 95% 1000000080 reload-into-ims override-lastmod
refresh_pattern -i \.(tiff|mov|avi|qt|mpeg|3gp)(\?.*)?$ 0 95% 201600000 reload-into-ims override-lastmod
refresh_pattern -i \.(mpg|mpe|wav|au|mid|flv)(\?.*)?$ 0 95% 2016000 reload-into-ims override-lastmod
refresh_pattern -i \.(zip|gz|arj|lha|lzh)(\?.*)?$ 0 95% 2016000 reload-into-ims override-lastmod
refresh_pattern -i \.(rar|tgz|tar|exe|bin)(\?.*)?$ 0 95% 2016000 reload-into-ims override-lastmod
refresh_pattern -i \.(cab|psf|part|0*|swf|gz|grf|gpf)(\?.*)?$ 0 95% 2000160 reload-into-ims override-lastmod
refresh_pattern -i \.(pdf|rtf|doc|swf|txt|inf)(\?.*)?$ 1 95% 2016000 reload-into-ims override-lastmod
refresh_pattern -i \.(inc|cab|ad|hqx|dll)(\?.*)?$ 10080 95% 4320000 reload-into-ims override-lastmod
refresh_pattern -i \.(asp|acgi|pl|shtml|php3|php)(\?.*)?$ 2 20% 432000 reload-into-ims override-lastmod
refresh_pattern -i \.(ini)(\?.*)?$ 2 5% 10800 reload-into-ims override-lastmod
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 40% 40320




# SNMP
snmp_port 3401
acl snmppublic snmp_community public
snmp_access allow snmppublic localhost
snmp_access deny all

# TAG: Extra Tuning Configuration
header_access Accept-Encoding deny all
client_persistent_connections off
server_persistent_connections on
half_closed_clients off
strip_query_terms off
quick_abort_min 0 KB
quick_abort_max 0 KB
quick_abort_pct 100
vary_ignore_expire on
reload_into_ims on
pipeline_prefetch on
range_offset_limit 512 KB
read_timeout 30 minutes
client_lifetime 6 hours
negative_ttl 30 seconds
positive_dns_ttl 6 hours
negative_dns_ttl 60 seconds
pconn_timeout 15 seconds
request_timeout 1 minute
store_avg_object_size 13 KB
log_icp_queries off
ipcache_size 1024
ipcache_low 98
ipcache_high 99
log_fqdn off
fqdncache_size 1026
memory_pools off
forwarded_for on
logfile_rotate 3
store_dir_select_algorithm round-robin
cache_effective_user proxy
cache_effective_group proxy
max_filedescriptors 8056

##end of config
**EDIT IP YANG DI TANDAI # -------------------- PADA SQUID CONF SESUAIKAN DENGAN NETWORK lan JURAGAN


setelah selesai tekan crtl+x lalu yes.
ok sekarang squid.conf anda yang baru sudah selesai

3. creat file storeurl.pl ( untuk video cache )
nano /etc/squid/storeurl.pl

lalu paste config storeurl.pl di bawah ini
#!/usr/bin/perl
# $Rev$
# by chudy_fernandez@yahoo.com
# Updates at http://wiki.squid-cache.org/ConfigExamples/DynamicContent/YouTube/Discussion
$|=1;
while (<>) {
@X = split;
# $X[1] =~ s/&sig=.*//;
$x = $X[0] . " ";
$_ = $X[1];
$u = $X[1];




# compatibility for old cached get_video?video_id
if (m/^http:\/\/([0-9.]{4}|.*\.youtube\.com|.*\.googlevideo\.com|.*\.video\.google\.com).*?(videoplayback\?id=.*?|video_id=.*?)\&(.*?)/) {
$z = $2; $z =~ s/video_id=/get_video?video_id=/;
print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $z . "\n";


# youtube HD itag=22
} elsif (m/^http:\/\/([0-9.]{4}|.*\.youtube\.com|.*\.googlevideo\.com|.*\.video\.google\.com).*?\&(itag=22).*?\&(id=[a-zA-Z0-9]*)/) {
print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $2 . "&" . $3 . "\n";


# youtube Normal screen always HD itag 35, Normal screen never HD itag 34, itag=18 <--normal?
} elsif (m/^http:\/\/([0-9.]{4}|.*\.youtube\.com|.*\.googlevideo\.com|.*\.video\.google\.com).*?\&(itag=[0-9]*).*?\&(id=[a-zA-Z0-9]*)/) {
print $x . "http://video-srv.youtube.com.SQUIDINTERNAL/" . $3 . "\n";


} elsif (m/^http:\/\/www\.google-analytics\.com\/__utm\.gif\?.*/) {
print $x . "http://www.google-analytics.com/__utm.gif\n";


#Cache High Latency Ads
} elsif (m/^http:\/\/([a-z0-9.]*)(\.doubleclick\.net|\.quantserve\.com|\.googlesyndication\.com|yieldmanager|cpxinteractive)(.*)/) {
$y = $3;$z = $2;
for ($y) {
s/pixel;.*/pixel/;
s/activity;.*/activity/;
s/(imgad[^&]*).*/\1/;
s/;ord=[?0-9]*//;
s/;&timestamp=[0-9]*//;
s/[&?]correlator=[0-9]*//;
s/&cookie=[^&]*//;
s/&ga_hid=[^&]*//;
s/&ga_vid=[^&]*//;
s/&ga_sid=[^&]*//;
# s/&prev_slotnames=[^&]*//
# s/&u_his=[^&]*//;
s/&dt=[^&]*//;
s/&dtd=[^&]*//;
s/&lmt=[^&]*//;
s/(&alternate_ad_url=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
s/(&url=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
s/(&ref=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
s/(&cookie=http%3A%2F%2F[^(%2F)]*)[^&]*/\1/;
s/[;&?]ord=[?0-9]*//;
s/[;&]mpvid=[^&;]*//;
s/&xpc=[^&]*//;
# yieldmanager
s/\?clickTag=[^&]*//;
s/&u=[^&]*//;
s/&slotname=[^&]*//;
s/&page_slots=[^&]*//;
}
print $x . "http://" . $1 . $2 . $y . "\n";


#cache high latency ads
} elsif (m/^http:\/\/(.*?)\/(ads)\?(.*?)/) {
print $x . "http://" . $1 . "/" . $2 . "\n";


# spicific servers starts here....
} elsif (m/^http:\/\/(www\.ziddu\.com.*\.[^\/]{3,4})\/(.*?)/) {
print $x . "http://" . $1 . "\n";


#cdn, varialble 1st path
} elsif (($u =~ /filehippo/) && (m/^http:\/\/(.*?)\.(.*?)\/(.*?)\/(.*)\.([a-z0-9]{3,4})(\?.*)?/)) {
@y = ($1,$2,$4,$5);
$y[0] =~ s/[a-z0-9]{2,5}/cdn./;
print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";


#rapidshare
} elsif (($u =~ /rapidshare/) && (m/^http:\/\/(([A-Za-z]+[0-9-.]+)*?)([a-z]*\.[^\/]{3}\/[a-z]*\/[0-9]*)\/(.*?)\/([^\/\?\&]{4,})$/)) {
print $x . "http://cdn." . $3 . "/SQUIDINTERNAL/" . $5 . "\n";


} elsif (($u =~ /maxporn/) && (m/^http:\/\/([^\/]*?)\/(.*?)\/([^\/]*?)(\?.*)?$/)) {
print $x . "http://" . $1 . "/SQUIDINTERNAL/" . $3 . "\n";


#like porn hub variables url and center part of the path, filename etention 3 or 4 with or without ? at the end
} elsif (($u =~ /tube8|pornhub|xvideos/) && (m/^http:\/\/(([A-Za-z]+[0-9-.]+)*?)\.([a-z]*[0-9]?\.[^\/]{3}\/[a-z]*)(.*?)((\/[a-z]*)?(\/[^\/]*){4}\.[^\/\?]{3,4})(\?.*)?$/)) {
print $x . "http://cdn." . $3 . $5 . "\n";
#...spicific servers end here.


#photos-X.ak.fbcdn.net where X a-z
} elsif (m/^http:\/\/photos-[a-z].ak.fbcdn.net\/(.*)/) {
print $x . "http://photos.ak.fbcdn.net/" . $1 . "\n";


#general purpose for cdn servers. add above your specific servers.
} elsif (m/^http:\/\/([0-9.]*?)\/\/(.*?)\.(.*)\?(.*?)/) {
print $x . "http://squid-cdn-url//" . $2 . "." . $3 . "\n";


#for yimg.com doubled
} elsif (m/^http:\/\/(.*?)\.yimg\.com\/(.*?)\.yimg\.com\/(.*?)\?(.*)/) {
print $x . "http://cdn.yimg.com/" . $3 . "\n";


#for yimg.com with &sig=
} elsif (m/^http:\/\/(.*?)\.yimg\.com\/(.*)/) {
@y = ($1,$2);
$y[0] =~ s/[a-z]+[0-9]+/cdn/;
$y[1] =~ s/&sig=.*//;
print $x . "http://" . $y[0] . ".yimg.com/" . $y[1] . "\n";


#generic http://variable.domain.com/path/filename."ext" or "exte" with or withour "?"
} elsif (m/^http:\/\/(.*)([^\.\-]*?\..*?)\/(.*)\.([^\/\?\&]{3,4})(\?.*)?$/) {
@y = ($1,$2,$3,$4);
$y[0] =~ s/(([a-zA-A-]+[0-9-]+)|(.*cdn.*)|(.*cache.*))/cdn/;
print $x . "http://" . $y[0] . $y[1] . "/" . $y[2] . "." . $y[3] . "\n";


# generic http://variable.domain.com/...
} elsif (m/^http:\/\/(([A-Za-z]+[0-9-]+)*?|.*cdn.*|.*cache.*)\.(.*?)\.(.*?)\/(.*)$/) {
print $x . "http://cdn." . $3 . "." . $4 . "/" . $5 . "\n";


# spicific extention that ends with ?
} elsif (m/^http:\/\/(.*?)\/(.*?)\.(jp(e?g|e|2)|gif|png|tiff?|bmp|ico|flv|on2)\?(.*)/) {
print $x . "http://" . $1 . "/" . $2 . "." . $3 . "\n";


# all that ends with ;
} elsif (m/^http:\/\/(.*?)\/(.*?)\;(.*)/) {
print $x . "http://" . $1 . "/" . $2 . "\n";


} else {
print $x . $_ . "\n";
}
}
setelah selesai tekan crtl+x lalu yes.


ok sekarang storeurl.pl anda sudah selesai
Hmmm Squid.conf Dan Storeurl.pl udah ada sekarang tinggal mengaktifkan Squid.conf,storeurl.pl dan creat cache di rektory dengan perintah
chown proxy:proxy /cache
chmod 777 /cache
ok jalan kan squid Now
/etc/init.d/squid restart


Misal ip untuk proxy dengan gatway dari mikrotik dengan ip 192.168.1.1 dan ip proxy 192.168.1.10

SET nat masquerade untuk gatway proxy :
chain=srcnat action=masquerade src-address=192.168.1.0/24

Transparant proxy :
chain=dstnat action=dst-nat to-addresses=192.168.1.10 to-ports=3128 protocol=tcp src-address=!192.168.1.10 dst-port=80

Reboot CPU Ubuntu, TAMAT.

Sumber : http://www.lintaskapuas.co.cc/2010/11/proxy-ubuntu-1010-64-bit-dengan-squid.html#ixzz1KES9u0Cu

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS