您好,登錄后才能下訂單哦!
閑話不說,進(jìn)入正題
準(zhǔn)備工具
httpd_-2.4.4.tar.bz2
apr-1.4.6.tar.gz(apache的一個(gè)可移植的運(yùn)行庫)
apr-util-1.5.1.tar.gz
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom/(建立光盤掛載點(diǎn))
cd /mnt/cdrom/Server/
ll apr*
rpm -ivh apr-devel-1.2.7-11.e15_3.1.i386.rpm(安裝apr 開發(fā)包)
安裝apr-1.4.6運(yùn)行庫
tar -zxvf apr-1.4.6.tar.gz -C/usr/local/src/
cd /usr/local/src/apr-1.4.6/
配置apr-1.4.6
ll
less README
./configure (默認(rèn)安裝到/usr/local目錄下自動(dòng)生成的apr目錄下)
make
make install
cd
安裝apr-util-1.5.1
tar -zxvf apr-util-1.5.1.tar.gz -C /usr/local/src/
cd /usr/local/src/apr-util-1.5.1/
ll
ls
./configure
./configure --with- apr=/usr/local/apr/bin/apr-1-config(要指定apr-config的完整路徑)
make
make install
Cd
安裝pcre 及其開發(fā)包(別問為什么要裝這個(gè),不裝會(huì)出問題的。。。)
ll /mnt/cdrom/Server/pcre*
rpm -ivh /mnt/cdrom/Server/pcre-6.6-2.el5_1.7.i386.rpm
rpm -ivh /mnt/cdrom/Server/pcre-devel-6.6-2.e15_1.7.i386.rpm
安裝http2.4.4
tar -jxvf httpd-2.4.4.tar.bz2 -C /usr/local/src/
cd /usr/local/src/httpd-2.4.4/
cd /usr/local/apr
vim /etc/ld.so.conf.d/apr.conf
寫入路徑/usr/local/apr/lib(讓系統(tǒng)調(diào)用運(yùn)行庫)
ldconfig加載
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd(配置文件目錄)--with-apr=/usr/local/apr/bin/apr-1-config(要指定apr-config的完整路徑)
make
make install
cd /usr/local/
cd bin/
./apachectl start
netstat -tupln |grep 80(查看80端口是否啟動(dòng))
此時(shí)調(diào)用的是apachectl,那么我們想調(diào)用自己的腳本來啟動(dòng)apache呢?
那就寫腳本吧。。
cd /etc/init.d
vim httpd
#!/bin/bash
#descriptionion: httpd server
#chkconfig: -88 90
HTTPD=’/usr/local/apache/bin/httpd’
CONFFILE=’etc/httpd/httpd.conf’
. /etc/init.d/FUNCTIONS
start() {
[-f /var/lock/subsys/http ] && echo “httpd is starting....”
echo -n “httpd is starting......”
sleep 1
$HTTPD -f $CONFFILE && RETVAL=0||RETVAL=1
[$RETVAL -eq 0] &&touch /var/lock/subsys/http && echo -e “\033[31m [ok] \033[0m”||echo -e “\033[31m [fail] \033[0m”
}
stop (){
Echo -n “httpd is stoping.....”
sleep 1
killproc httpd && RETVAL=0||RETVAL=1
[$RETVAL -eq 0] && rm -rf /var/lock/subsys/http ||echo -e “\033[31m [fail] \033[0m”
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo “Usage:start|stop|restart”
;;
esac
chmod a+x httpd
chkconfig --add httpd(把httpd服務(wù)設(shè)置開機(jī)自啟動(dòng))
結(jié)束
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。