Monday, May 26, 2008

บันทึกการติดตั้ง Web Server บน FreeBSD6.2

Web Server เป็นชื่อเรียกของ Service ซึ่งเป็นซอฟแวร์ที่เน้นการทำงานทางด้านเซิร์ฟเวอร์เป็นหลัก และโปรแกรมที่ทำหน้าที่เป็น Web Server ก็มหลายตัวด้วยกันนะครับ ทั้งที่ฟรี และไม่ฟรี เช่น apache ซี่งเป็นซอฟร์แวร์ของโอเพ่นซอร์ส และ IIS ซึ่งเป็นซอฟร์แวร์ของไมโครซอฟร์(ตัวนี้ต้องซื้อ) แต่ในที่นี้ผมจะขอแนะนำการติดตั้ง apache ซึ่งรันบนระบบปฏิบัติการ FreeBSD.

Step1. Login with root & #cd /usr/ports/distfiles

Step2. #fetch http://lion.bus.ubu.ac.th/oss/FreeBSD/FAMP62.tar.gz

Step3. #gzip -cd FAMP62.tar.gz |tar xvf - (ระหว่าง xvf กับ - ต้องวรรคด้วย)

Step4. #cd /usr/ports/www/apache22

Step5. #make install(Please wait...)

###Configuration Apache22
Step1. #vi /usr/local/etc/apache22/httpd.conf

Step2. Edit and add this line to httpd.conf file
Directory index.php index.html
AddDefaultCharset tis-620
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Step3. Save and exit

Step4. #apachectl restart

###Config apache with auto start service
Step1. #echo "apache22_enable="YES"" >> /etc/rc.conf

Step2. #restart server

##### Good Luck and Enjoy #####

No comments: