ติดตั้ง Apache
จาก NakhonNet
Slackware ได้ติดตั้ง Apache Web Server มาให้แล้ว จึงเพียงแต่ config ค่าที่ต้องใช้งานเท่านั้น
httpd.conf
แก้ไขไฟล์ /etc/httpd/httpd.conf ดังนี้
- กำหนดให้เซิร์ฟเวอร์เรียกไฟล์ index.php ก่อนเรียก index.html
เดิม (บรรทัดที่ 231)
DirectoryIndex index.html
แก้เป็น
DirectoryIndex index.php index.html
- เปิดการใช้งาน virtual host
เดิม (บรรทัดที่ 453)
#Include /etc/httpd/extra/httpd-vhosts.conf
แก้เป็น
Include /etc/httpd/extra/httpd-vhosts.conf
- เรียกใช้ PHP
เดิม (บรรทัดที่ 478)
#Include /etc/httpd/mod_php.conf
แก้เป็น
Include /etc/httpd/mod_php.conf
virtual host
แก้ไขไฟล์ /etc/httpd/extra/httpd-vhosts.conf ดังนี้
NameVirtualHost *:80
<Directory "/www/phpMyAdmin">
Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName diskserv.localnet
DocumentRoot /www/diskserv/app/webroot
Alias /phpMyAdmin /www/phpMyAdmin
<Directory "/www/diskserv/app">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/www/diskserv/app/webroot">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
<Files sitemap.xml>
RewriteEngine Off
</Files>
</Directory>
</VirtualHost>
php.ini
แก้ไขไฟล์ /etc/httpd/php.ini ดังนี้
เดิม (บรรทัดที่ 1034)
;date.timezone =
แก้เป็น
date.timezone = Asia/Bangkok
เมื่อแก้ไขไฟล์ต่างๆ ทั้งหมดแล้ว ก็สั่งให้ httpd เริ่มทำงานใหม่ ดังนี้
/etc/rc.d/rc.httpd restart
โดยจะมีคำเตือนว่า ยังไม่มีไดเรกทอรี /www/diskserv/app/webroot เพราะไดเรกทอรีนี้จะสร้างในขั้นตอนต่อๆ ไป