一、编译安装方式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
浏览器输入服务器地址: