LightSquid 1.7+Ubuntu 12.04+Krucomchan1.2
ใช้ Light squid 1.7.1 Download สไตล์บ้าน ๆ
1. Copy lightsquid-1.7.1.tgz to /var/www
2. tar -zxvf lightsquid-1.7.1.tgz
3. ใช้ Fillzilla copy lightsquid1.7 to Client PC
4. mkdir /var/www/lightsquid
5. copy all files from lightsquid1.7 from client PC to /var/www/lightsquid
5.1 chown -R www-data:www-data lightsquid
6. cd /var/www/lightsquid then
ตั้งค่าให้ script ทำงานได้
# chmod +x *.cgi
# chmod +x *.pl
7. nano /var/www/lightsquid/lightsquid.cfg
$cfgpath ="/var/www/lightsquid";
$tplpath ="/var/www/lightsquid/tpl";
$langpath ="/var/www/lightsqui/lang";
$reportpath ="/var/www/lightsquid/report";
$logpath ="/var/lib/squid3/"; <------- font="" server="">
$ip2namepath ="/var/www/lightsquid/ip2name";
$lockpath =$reportpath;
$maxlocktime = 30*60;
$debug = 0;
$debug2 = 0;
$graphreport = 0; <------- font="" gd.pm="" libgd="" module="">------->------->
"" เอาเครื่องหมาย " " ออกนะครับ
AddHandler cgi-script .cgi
AllowOverride All
"
"
แล้ว restart apache2
user ตัวที่สองคือ พาสเวิร์ด
https://drive.google.com/file/d/0B1HFQ6KGvePGb29KWExXTnFsZUE/view?usp=sharing
1. Copy lightsquid-1.7.1.tgz to /var/www
2. tar -zxvf lightsquid-1.7.1.tgz
3. ใช้ Fillzilla copy lightsquid1.7 to Client PC
4. mkdir /var/www/lightsquid
5. copy all files from lightsquid1.7 from client PC to /var/www/lightsquid
5.1 chown -R www-data:www-data lightsquid
6. cd /var/www/lightsquid then
ตั้งค่าให้ script ทำงานได้
# chmod +x *.cgi
# chmod +x *.pl
7. nano /var/www/lightsquid/lightsquid.cfg
$cfgpath ="/var/www/lightsquid";
$tplpath ="/var/www/lightsquid/tpl";
$langpath ="/var/www/lightsqui/lang";
$reportpath ="/var/www/lightsquid/report";
$logpath ="/var/lib/squid3/"; <------- font="" server="">
$ip2namepath ="/var/www/lightsquid/ip2name";
$lockpath =$reportpath;
$maxlocktime = 30*60;
$debug = 0;
$debug2 = 0;
$graphreport = 0; <------- font="" gd.pm="" libgd="" module="">------->------->
8. -แก้ไขค่าคอนฟิกของ Apache ให้รัน cgi ได้ เสร็จแล้ว restart Apache
nano /etc/apache2/apache2.conf
เพิ่ม 4 บรรทัดนี้ลงไปท้ายๆ เลยครับ
"
AddHandler cgi-script .cgi
AllowOverride All
"
แล้ว restart apache2
9. cd /var/www/lightsquid
10. ./check-setup.pl
11. # crontab -e
0 4 * * * /usr/sbin/squid -k rotate
5 4 * * * /www/lightsquid/lightparser.pl
12. nano /etc/squid3/squid.conf
13. บรรทัดนี้ cache_access_log /var/log/squid3/access.log common แก้เป็น
#cache_access_log /var/log/squid3/access.log common
14. /var/www/lightsquid/lightparser.pl
15. /etc/init.d/squid3 restart
10. ./check-setup.pl
11. # crontab -e
0 4 * * * /usr/sbin/squid -k rotate
5 4 * * * /www/lightsquid/lightparser.pl
12. nano /etc/squid3/squid.conf
13. บรรทัดนี้ cache_access_log /var/log/squid3/access.log common แก้เป็น
#cache_access_log /var/log/squid3/access.log common
14. /var/www/lightsquid/lightparser.pl
15. /etc/init.d/squid3 restart
16. เข้าดู http://IP/lightsquid
--------------------------------------------------------------------------------------
หากอยากให้ login ก่อนเข้าดู Report Lightsquid ให้ทำดังนี้
htpasswd -c /var/www/html/lightsquid/passwords admin
ระบบให้ใส่ password ใหม่ 2 ครั้ง
New password:*******
Re-type new password:*******
Adding password for user admin
จากนั้น แก้ไขไฟล์ .htaccess FPRIVATE "TYPE=PICT;ALT= "
โดย พิมพ์
nano /var/www/html/lightsquid/.htaccess
เพิ่มข้อความแทรกหน้าบรรทัด
Options FollowSymLinks ExecCGI
DirectoryIndex index.cgi
ดังนี้
AuthType Basic
AuthGroupFile /dev/null
AuthName "Squid Report"
AuthUserFile /var/www/html/lightsquid/passwords
require user admin admin <---------- admin="" cordia="" face="" font="" lang="TH" nbsp="" new="" sans-serif="" style="font-size: 14pt; line-height: 21.466665267944336px;">ตัวแรกคือ ---------->
จากนั้นให้ รีสตาร์ท httpd
/etc/init.d/httpd restart
---------------------------------------------------------------------------------------------------------
ปรับแต่ง Lightsquid รายงานผลด้วย ชื่อผู้ใช้ + Mac Address
ปรับแต่ง Lightsquid รายงานผลด้วย ชื่อผู้ใช้ + Mac Address ดาวน์โหลดไฟล์ ข้างล่าง
https://drive.google.com/file/d/0B1HFQ6KGvePGb29KWExXTnFsZUE/view?usp=sharing
1. อับโหลดไฟล์ realname.pl ไปไว้ที่ห้อง /var/www/lightsquid/
แก้ไขไฟล์ realname.pl บรรทัดที่ 29 ดังนี้
$dbh = DBI->connect($dsn,"root", "mysqlrootpassword"); << mysql root password
2. พิมพ์คำสั่ง chmod +x /var/www/lightsquid/realname.pl
3. Use Notepad++ สร้างไฟล์ th.lng แล้ว copy to /var/www/lightsquid/lang/th.lng
4. สั่งให้ไฟล์ realname.pl ทำงานด้วยคำสั่ง /var/www/lightsquid/realname.pl
5. สั่งให้ Lightsquid รับค่าใหม่ ด้วยคำสั่ง /var/www/lightsquid/lightparser.pl
6. ตั้งค่า crontab ให้รับค่า Lightsquid ทุก 5 นาที ทุกวัน ด้วยคำสั่ง
echo '5 * 1-31 * * root /var/www/lightsquid/lightparser.pl' >> /etc/crontab
crontab -e
0 3 * * * /usr/sbin/squid -k rotate
59 4 * * * /var/www/lightsquid/lightparser.pl
50 4 * * * /var/www/lightsquid/realname.pl
*/4 * * * * /etc/chilli/chilli_unstop.sh
Notice path /var/www/lightsquid
-----------------------------------------------------
nano /etc/squid3/squid.conf
then remove commom from then end of this line
cache_access_log /var/log/squid3/access.log common
restart squid3
ความคิดเห็น