hoctinhoc |
07-02-2010 10:16 PM |
Cài đặt Proxy Server để tăng tốc độ lướt web với Squid
Cài đặt Proxy Server để tăng tốc độ lướt web với Squid
1. Cài đặt và cấu hình Squid trên Server [trên server]
Mã:
[root@lan ~]# yum -y install squid
Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for squid to pack into transaction set.
squid-2.6.STABLE6-4.el5.i 100% |========================| 139 kB 00:00
---> Package squid.i386 7:2.6.STABLE6-4.el5 set to be updated
--> Running transaction check
Dependencies Resolved
===========================================================
Package Arch
Version
Repository
Size
===========================================================
Installing:
squid i386
7:2.6.STABLE6-4.el5
updates
1.2 M
Transaction Summary
===========================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 1.2 M
Downloading Packages:
(1/1): squid-2.6.STABLE6- 100% |====================| 1.2 M 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: squid#################################### [1/1]
Installed: squid.i386 7:2.6.STABLE6-4.el5
Complete!
[root@lan ~]# vi /etc/squid/squid.conf
http_port 8080 // Thay đôi port cho proxy
acl CONNECT method CONNECT
acl lan src 192.168.0.0/255.255.255.0 // Thêm (Chỉ cho phép LAN)
http_access allow localhost
http_access allow lan // Thêm (Chỉ cho phép LAN)
http_access deny all
visible_hostname lan.quantrinet.com // Thêm dòng
# forwarded_for on
forwarded_for off
header_access Referer deny all // Thêm
header_access X-Forwarded-For deny all
header_access Via deny all
header_access Cache-Control deny all
[root@lan ~]# /etc/rc.d/init.d/squid start
init_cache_dir /var/spool/squid... Starting squid: [ OK ]
[root@lan ~]# chkconfig squid on
2. Cấu hình kết nối đến proxy server [trên Client]
Open Internet Explore -> Chọn [Tools] -> [Internet Options] -> Chọn Connections Tab
http://server-world.info/en/CentOS_5/squid/img/1.jpg
Chọn tiếp LAN Setting và điền vào thông tin của Proxy Server
http://quantrinet.com/images/2proxy.jpg
Done!
Chúc các bạn thành công!
:battay:
|