2008年6月16日 星期一

Apache Server 建立

必須安裝的套件 httpd-2.xxx.ent.i386.rpm
rpm –ivh httpd.xxx.rpm
chkconfig httpd on
service httpd start
相關設定 /etc/httpd/conf/httpd.conf
網頁存放處 DocumentRoot “/var/www.html”
預設瀏覽檔案DirectoryIndex index.html index.html.var
個人網頁是否開放UserDir disable,若要開放,請將此行註解掉並將 UserDir public_html註解取消
將/home/username目錄權限設為701,chmod 701 /home/antonio
個人網頁存放處 UserDir public_html
啟動時server數 StartServers 8
閒置的最少數 MinSpareServer 5
閒置的最大數MaxSpareServer 20
同時啟動最大數 ServerLimit 256
client開啟最大數(可超過ServerLimit)MaxClients 256
一個Process執行次數MaxRequestsPerChild 4000
以何身份執行User apache
以何群組執行Group apach
回應Server資訊別ServerTokens Full OS Min
是否反解用戶端名稱Hostnamelookup Off
netstat –ntlup grep 80

VirtualHost –Name Base
mkdir /var/www/vhost
mkdir /var/www/vhost/name_base
mkdir /var/www/vhost/name_base/station00
mkdir /var/www/vhost/name_base/www00
echo “This is http://www00.example.corp” > /var/www/vhost/name_base/www00/index.html
echo “This is http://statuin00.example.corp” > /var/www/vhost/name_base/station00/index.html
設定主要檔 vi /etc/httpd/conf/httpd.conf
找到NameVirtualHost 192.168.1.97:80(刪除註解並加入自己的IP)
設定兩個NameBase 的設定檔
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/www00.conf
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/station00.conf

vi /etc/httpd/conf.d/www00.conf

ServerAdmin root@www00.example.corp
DocumentRoot /var/www/vhost/name_base/www00
ServerName www00.example.corp


vi /etc/httpd/conf.d/station00.conf

ServerAdmin root@station00.example.corp
DocumentRoot /var/www/vhost/name_base/station00
ServerName station00.example.corp

Service httpd restart
可用tail –f /var/log/messages 來觀查啟動成功與否

沒有留言: