Installing Lighttpd on Mac OS X

อันนี้ใช้วิธีลงผ่าน DarwinPorts

  • ลง DarwinPorts เป็น .dmg ปกติ รัน Installer จนเสร็จ
  • DarwinPorts จะอยู่ที่ /opt/local/bin เพื่อให้ shell มองเห็นคำสั่ง แก้ไฟล์ /etc/profile
    PATH="/opt/local/bin:/bin:/sbin:/usr/bin:/usr/sbin"
  • ปิด Terminal เดิมแล้วเปิดอันใหม่
  • อัพเดตรายการแพกเกจ sudo port -d selfupdate
  • ติดตั้ง sudo port install lighttpd
  • แก้คอนฟิก /opt/local/etc/lighttpd/lighttpd.conf (ก็อปมาจาก lighttpd.conf.default)
    ของผมเปลี่ยนเป็นพอร์ต 81 เพราะจะรันคู่กับ apache
  • ใน config ระบุ document root เป็น /www/pages และ log เป็น /www/logs มีทางเลือกสองทางคือสร้างขึ้นมา หรือเปลี่ยนไปใช้ที่อื่น (อย่าลืมเช็คเรื่อง permission ของ directory logs ด้วย)
  • สร้างเพจทดสอบใน document root เช่น /www/pages/index.html หรือจะใช้ของ Apache ก็ได้ (อยู่ที่ /Library/WebServer/Documents/)
  • พร้อมแล้วก็ sudo lighttpd -f /opt/local/etc/lighttpd/lighttpd.conf
  • ทดสอบการใช้งาน http://localhost:81/

ปรากฎว่าบน OS X มีปัญหามันช้าผิดสังเกต เลยหนีไปใช้บน Debian ก็ apt-get install lighttpd ได้โดยตรง ไม่ต้องสร้าง config, document root เองด้วย สะดวกมาก

เอกสารประกอบ:

Add new comment