1. 程式人生 > >Debian:從原始碼安裝Apache

Debian:從原始碼安裝Apache

先安裝一些依賴的庫:

aptitude  install build-essential
apt-get install libapr1-dev libaprutil1-dev

然後安裝Zlib和Apache。現在Zlib最新的版本為 1.2.8 ,Apache的最新穩定版為:2.4.9
wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxf zlib-1.2.8.tar.gz
cd zlib-1.2.8/
./configure --prefix=/usr/local
make && make install



wget http://www.apache.org/dist/httpd/httpd-2.4.9.tar.gz
tar -zxf httpd-2.4.9.tar.gz
cd httpd-2.4.9/
./configure  --prefix=/usr/local/apache --enable-mods-shared=most --enable-ssl=shared --with-ssl=/usr/local
make && make install

啟動Apache服務:
ln -s /usr/local/apache/bin/apachectl /usr/local/bin
ln -s /usr/local/apache/bin/httpd /usr/local/bin


然後就可以執行下面三個命令了:

apachectl -k start
apachectl -k stop
apachectl -k restart

設定Apache服務開機自啟動:
ln -s /usr/local/apache/bin/apachectl /etc/init.d/
update-rc.d apachectl defaults