Rabu, 28 Mei 2014

Delay Pool Video Streaming dengan Squid



Membatasi bandwidth client dengan script yang ditambahkan di squid.conf :
1. tambahkan script dibawah ini di squid.conf
2. simpan dan exit
3. restart squid via Run ---> services.msc ----> klik kanan services squid ---> restart

** scrip berikut mempunyai keistimewaan :
a. browsing mendapatkan full speed
b. apapun yg pernah di cache (download n streaming, contohnya) tidak akan terlimited
c. game-online tetap lancar tanpa "lag"
d. kompi yg terinstall squid ikut terlimit "download dan streamingnya" tidak terlimit lainnya

**** silahkan pilih dari beberapa cara scrip dibawah ini ***
**** semua cara dibawah ini untuk melimit download n streaming s/d 48KBps *****
**** ubah batasan limited dengan mengubah angka 48000 menjadi suka-suka saja ***

**** letakkan salah satu cara script dibawah ini pada bagian ****
#################################################
# Simple delaypools added by imer :shakehand #
# default setting is disabled #
# enable it by removing # mark at start of line #
#################################################

####cara pertama - class 2###
# bila client melakukan download file apapun
acl jupukfile url_regex -i \.*

# bila client melakukan streaming video
acl delokvideo url_regex -i watch\? get_video\?video_id videodownload\? videoplayback\? videoplay\? dailymotion video\.[a-z]\.fbcdn\.net video\flv video\mpg video\quicktime video\x-flv video\mp4 video\x-avi video\x-mpeg video\x-wmv video\flash video\x-mpeg4 video\x-mpg video\x-mov video\mov video\avi

# dibuat 2 aturan
delay_pools 2

# aturan 1, tidak ada pembatasan untuk browsing
delay_class 1 2
delay_parameters 1 -1/-1 -1/-1

# aturan 2, setelah download/streaming 512 KB mk download/streaming menjadi 48 KBps
delay_class 2 2
delay_parameters 2 -1/512000 48000/513000

# menerapkan aturan, aturan diterapkan dulu dari aturan ke 2 #
# bila bukan termasuk aturan ke 2, maka akan diterapkan aturan ke 1 #
delay_access 2 allow jupukfile
delay_access 2 allow delokvideo
delay_access 2 deny all

delay_access 1 deny jupukfile
delay_access 1 deny delokvideo
delay_access 1 allow all
####EOF cara pertama - class 2####




####cara kedua - class 2###
# bila client melakukan download file apapun
acl jupukfile url_regex -i \.*

# bila client melakukan streaming video
acl delokvideo url_regex -i watch\? get_video\?video_id videodownload\? videoplayback\? videoplay\? dailymotion video\.[a-z]\.fbcdn\.net video\flv video\mpg video\quicktime video\x-flv video\mp4 video\x-avi video\x-mpeg video\x-wmv video\flash video\x-mpeg4 video\x-mpg video\x-mov video\mov video\avi

# dibuat 2 aturan
delay_pools 2

# aturan 1, tidak ada pembatasan untuk browsing
delay_class 1 2
delay_parameters 1 -1/-1 -1/-1

# aturan 2, setelah download/streaming 512 KB mk download/streaming menjadi 48 KBps
delay_class 2 2
delay_parameters 2 -1/-1 48000/513000

# menerapkan aturan, aturan diterapkan dulu dari aturan ke 2 #
# bila bukan termasuk aturan ke 2, maka akan diterapkan aturan ke 1 #
delay_access 2 allow jupukfile
delay_access 2 allow delokvideo
delay_access 2 deny all

delay_access 1 deny jupukfile
delay_access 1 deny delokvideo
delay_access 1 allow all
####EOF cara kedua - class 2####


####cara ketiga - class 1###
# bila client melakukan download file apapun
acl jupukfile url_regex -i \.*

# bila client melakukan streaming video
acl delokvideo url_regex -i watch\? get_video\?video_id videodownload\? videoplayback\? videoplay\? dailymotion video\.[a-z]\.fbcdn\.net video\flv video\mpg video\quicktime video\x-flv video\mp4 video\x-avi video\x-mpeg video\x-wmv video\flash video\x-mpeg4 video\x-mpg video\x-mov video\mov video\avi

# dibuat 2 aturan
delay_pools 2

# aturan 1, tidak ada pembatasan untuk browsing
delay_class 1 1
delay_parameters 1 -1/-1

# aturan 2, setelah download/streaming 512 KB mk download/streaming menjadi 48 KBps
delay_class 2 1
delay_parameters 2 48000/513000

# menerapkan aturan, aturan diterapkan dulu dari aturan ke 2 #
# bila bukan termasuk aturan ke 2, maka akan diterapkan aturan ke 1 #
delay_access 2 allow jupukfile
delay_access 2 allow delokvideo
delay_access 2 deny all

delay_access 1 deny jupukfile
delay_access 1 deny delokvideo
delay_access 1 allow all
####EOF cara ketiga - class 1####


####cara keempat - class 1###
# bila client melakukan download file apapun
acl jupukfile url_regex -i \.*

# bila client melakukan streaming video
acl delokvideo url_regex -i watch\? get_video\?video_id videodownload\? videoplayback\? videoplay\? dailymotion video\.[a-z]\.fbcdn\.net video\flv video\mpg video\quicktime video\x-flv video\mp4 video\x-avi video\x-mpeg video\x-wmv video\flash video\x-mpeg4 video\x-mpg video\x-mov video\mov video\avi

# dibuat 2 aturan
delay_pools 2

# aturan 1, tidak ada pembatasan untuk browsing
delay_class 1 1
delay_parameters 1 -1/-1
delay_access 1 deny jupukfile
delay_access 1 deny delokvideo
delay_access 1 allow all

# aturan 2, setelah download/streaming 512000 bytes mk download/streaming menjadi 48000 bytes/s

delay_class 2 1
delay_parameters 2 48000/512000
delay_access 2 allow jupukfile
delay_access 2 allow delokvideo
delay_access 2 deny all

####EOF cara keempat - class 1#### 
Sumber : cyberblok12.blogspot.com

Minggu, 20 April 2014

Debian /var/www/ file permissions





The way I normally setup Debian systems is as follows:

1) As root, create a new group called 'www' then place yourself within that group, logout and back in for it to take effect.

sudo groupadd www
sudo gpasswd -a  www
logout

2) Make the entire /var/www directory structure be owned by 'www-data' and the 'www' group. Give users belonging to the 'www' group write permissions, then set the sticky bit on the group for this directory structure so that any new directories created will take on these same permissions.

sudo chown -R www-data:www /var/www
sudo find /var/www -type f -exec chmod 664 {} \;
sudo find /var/www -type d -exec chmod 775 {} \;
sudo find /var/www -type d -exec chmod g+s {} \;

That should now give you sufficient permissions to create directories and files within /var/www manually (ie: Via a terminal). If you want these directories to be writtable by the server process you will however need to chown them to www-data:www. Any new directories created by the Apache process will automatically be owned by www-data:www.

3) Allow users within the 'www' group to change directories they own within /var/www to be owned by 'www-data:www'.

sudo sudoedit /etc/sudoers

Then add the following line.....

%www ALL = NOPASSWD: /bin/chown www-data /var/www/*, /bin/chown -R www-data /var/www/*

This means users within the 'www' group can now execute....

sudo chown www-data /var/www/<directoryname>

on directories they own, making them writtable via the Apache process.

That's basically it. Allot of people like to simply join the www-data group and set the sticky bit on /var/www but you generally don't want all directories to be writtable by the Apache process. 

--------------------
Sumber : http://forums.phpfreaks.com/topic/186274-debian-varwww-file-permissions/