安裝pcre
解壓縮後進入pcre-8.32
編譯安裝: ./configure --prefix=/usr/local/pcre --enable-pcre8 --enable-pcre16 --enable-pcre32 --enable-utf && make && make install
安裝curl
解壓縮後進入curl-7.31.0
編譯安裝: ./configure --prefix=/usr/local/curl --enable-http --enable-ftp --enable-file --enable-proxy --enable-pop3 --enable-imap --enable-smtp --enable-cookies && make && make install
安裝apr
解壓縮後進入apr-1.4.6
編譯安裝: ./configure --prefix=/usr/local/apr && make && make install
安裝apr-util
解壓縮後進入apr-util-1.5.1
編譯安裝: ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make && make install
安裝apache
解壓縮後進入httpd-2.4.3
配置: ./configure --prefix=/usr/local/apache --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-z=/usr/local/zlib --enable-cache
--enable-file-cahce --enable-disk-cache --enable-mem-cache --sysconfdir=/etc/httpd --enable-mods-shared=all --enable-deflate --enable-speling --enable-so
--enable-expires=shared --enable-rewrite=shared --enable-static-support --disable-userdir
編譯: make
安裝: make install
安裝後進入apache下面的bin文件夾,使用命令: cd /usr/local/apache/bin
啓動apache,命令: ./apachectl start
啓動後在瀏覽器輸入 http://localhost 如果顯示 It Works! 說明apache安裝成功
接下來修改apache的配置文件,命令:
vi /etc/httpd/httpd.conf , 打開後在小寫鍵盤模式下 按 j 到
#ServerName www.example.com:80
再按 x 刪除掉 # ,再按ESC , 再輸入 :wq 保存退出
接下來把apache服務設置爲開機啓動,使用命令: cd /etc/rc.d 進入 rc.d 文件夾
再用命令 vi rc.local 打開 rc.local 文件
鍵盤切換成大寫,按G,切換成小寫,按o,輸入以下代碼
/usr/local/apache/bin/apachectl start
按ESC退出插入模式,再輸入 :wq 保存退出
把bin文件夾裏面的apachectl文件複製到/usr/bin文件夾裏面,命令: cp /usr/local/apache/bin/apachectl /usr/bin/httpd
這樣以後就能在終端直接開啓,停止,重啓apache服務來。注意:上面的apachectl已經被我重命名爲httpd
到這裏apache服務器編譯安裝完成
下一篇博文介紹mysql和php的安裝