一、編譯安裝方式c++
源碼包下載,並上傳到服務器:apache
https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.43.tar.gz瀏覽器
查看是否安裝有apache:服務器
rpm -qa httpdapp
安裝依賴包及相關軟件:ide
yum install pcre-devel zlib-devel expat-devel gcc gcc++ -y測試
上傳apr-1.7.0.tar.gz並安裝:spa
tar zxf apr-1.7.0.tar.gzblog
cd apr-1.7.0get
./configure
make && make install
上傳apr-util-1.6.1.tar.gz並安裝:
tar zxf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure -with-apr=/usr/local/apr/bin/apr-1-config
make && make install
添加apache用戶:
useradd -s /sbin/nologin -M apache
創建安裝目錄:
mkdir /application
解壓源碼安裝包:
tar zxf httpd-2.4.43.tar.gz
cp -rf ./apr-1.7.0 ./httpd-2.4.43/srclib/apr
cp -rf ./apr-util-1.6.1 ./httpd-2.4.43/srclib/apr-util
編譯安裝:
cd httpd-2.4.43
./configure \
--prefix=/application \
--with-included-apr \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-modules=most \
--enable-so \
--with-mpm=worker \
--enable-rewrite
二、啓動
/application/bin/apachectl -t #語法檢查
/application/bin/apachectl start #啓動
三、測試
netstat -lntup|grep 80
瀏覽器輸入服務器地址: