สำหรับ admin ท่านใด ที่เวปมีจำนวนคนเข้าเยอะๆลอง ดูนะครับ ใช้ Squid มาช่วยในส่วน ของ WebServer ลด รีซอส cpu ไปได้ 30-40 % เลยทีเดียว
ตัวอย่าง Squid.conf
สำหรับ( webserver ) http_port 8080
icp_port 0
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
cache_mem 16 MB
cache_dir ufs /cache 200 16 256
emulate_httpd_log on
redirect_rewrites_host_header off
replacement_policy GDSF
acl all src 0.0.0.0/0.0.0.0
http_access allow all
cache_mgr
[email protected] cache_effective_user squid
cache_effective_group squid
httpd_accel_host 208.164.186.3
httpd_accel_port 80
log_icp_queries off
cachemgr_passwd my-secret
จากนั้นก็ให้ใช้ Iptables เอานะครับ
ตัวอย่าง
iptables -t nat -A PREROUTING -p tcp -m tcp -d 127.0.0.1/32 --dport 8080-j DROP
iptables -t nat -A PREROUTING -p tcp -m tcp -d 127.0.0.1/32 --dport 80 -j REDIRECT --to-ports 8080จากนั้นก็save ค่าด้วยคำสั่ง
service iptables saveลองดูกระฉูดหูรูดเลยครับเปิดเวปด้วย Squid
Multi-level Web CachingThe second method of proxy cache is the so-called Multi-level Web Caching where you choose to share and cooperate with more proxy-cache servers on the Internet. With this method, your organization uses the cache of many others proxy cache servers, and to compensate, the other cache server can use yours. It's important to note that in this situation, the proxy cache can play two different roles in the hierarchy. It can be configured to be a sibling cache, and be able to only serve documents it already has, or it can be configured as a parent cache, and be able to get documents from another cache or from the source directly.