ผู้เขียน หัวข้อ: ทำ Proxy Server ด้วย varnish (เร็วกว่า Squid)  (อ่าน 2024 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ ผู้ดูแลระบบ

  • ยิ้มวันละนิด จิตแจ่มใส
  • Administrator
  • *****
  • กระทู้: 156
  • จิตใจสงบ ชีวิตเป็นสุข
    • ดูรายละเอียด
    • ศูนย์คอมพิวเตอร์และเครือข่ายวารินชำราบ
ทำ Proxy Server ด้วย varnish (เร็วกว่า Squid)
« เมื่อ: วันที่ 04 กรกฎาคม 2017, 15:23:03 »
ทำ Proxy Server ด้วย varnish (เร็วกว่า Squid)
 here: here: here:

 here: here: here:
ตัวอย่างนี้เป็นการติดตั้ง Varnish on Ubuntu Server 16.04
ก่อนอื่น login ด้วยสิทธิ์ root
อัพเดท server
sudo apt-get update

ติดตั้งvarnish
sudo apt-get install varnish -y


ติดตั้งเสร็จแก้ไขค่าคอนฟิก
nano /etc/default/varnish
แก้ port จาก
DAEMON_OPTS="-a :6081 \
เป็น
DAEMON_OPTS="-a :80 \

แก้ Varnish VCL configuration
nano /etc/varnish/default.vcl
เป็น

backend default {
 .host = "127.0.0.1";
 .port = "8080";
 }

แก้ port หากใช้ Apache Virtualhost
nano /etc/apache2/sites-enabled/000-default.conf

จาก
<VirtualHost *:80>

เป็น

<VirtualHost *:8080>

Restart Apache and Varnish
systemctl restart apache2.service
systemctl restart varnish.service

เช็กการทำงาน check the process
ps aux | grep vcache
---------------------------------------
vcache 15569 0.0 0.7 125044 7816 ? Ss 08:20 0:00 /usr/sbin/varnishd -j unix,user=vcache -F -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
vcache 15581 0.0 9.3 272012 94900 ? Sl 08:20 0:00 /usr/sbin/varnishd -j unix,user=vcache -F -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
--------------------------------------

แก้ port arnish.service
nano /lib/systemd/system/varnish.service

จาก
[...]
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
[...]

เป็น
[...]
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
[...]

Reload and restart Apache and Varnish

systemctl daemon-reload
systemctl restart apache2.service
systemctl restart varnish.service

เช็กการทำงาน
varnishstat

เช็กการทำงานออนเว็บ
curl -I http://your_ip
---------------------------------------
HTTP/1.1 200 OK
Date: Wed, 22 Jun 2016 08:32:03 GMT
Server: Apache/2.4.18 (Ubuntu)
Last-Modified: Wed, 22 Jun 2016 08:18:20 GMT
Vary: Accept-Encoding
Content-Type: text/html
X-Varnish: 32771
Age: 0
Via: 1.1 varnish-v4
ETag: W/"2c39-535d9949460b3-gzip"
Accept-Ranges: bytes
Connection: keep-alive
----------------------------

แสดงว่าการทำงานถูกต้อง End

ออฟไลน์ Mawwan

  • อนุบาล
  • *
  • กระทู้: 1
  • สวัสดี
    • ดูรายละเอียด
Re: ทำ Proxy Server ด้วย varnish (เร็วกว่า Squid)
« ตอบกลับ #1 เมื่อ: วันที่ 28 สิงหาคม 2018, 13:59:08 »
วิธีการทำ Proxy Server ด้วย varnish ทำยังไงค่ะ ฉันสนใจเรื่องนี้มากเลยนะค่ะ สำหรับใครที่ต้องการททำ Proxy Server ด้วย varnish  ต้องเข้ามาดูที่เว็บนี้คะ
« แก้ไขครั้งสุดท้าย: วันที่ 05 พฤศจิกายน 2018, 19:59:04 โดย ผู้ดูแลระบบ »

ออฟไลน์ datingloG

  • datingloGTG
  • อนุบาล
  • *
  • กระทู้: 2
  • เพศ: ชาย
  • ะšะ—ะกะšา‘ะฅ
    • ดูรายละเอียด
    • Finest asual Dating - Living Women
Unsurpassed asual Dating - Live Women
« ตอบกลับ #2 เมื่อ: วันที่ 07 กุมภาพันธ์ 2024, 20:12:06 »
Casual dating at its finest  join the leading platform for relaxed and fun encounters!
Authentic Maidens
Supreme asual Dating