yum安装
yum install -y httpd
#查看通过yum安装的mpm应用
#启动
systemctl start httpd
#设置开机启动
systemctl enable httpd
#停止
systemctl stop httpd
httpd -l
Compiled in modules:
core.c
mod_so.c
http_core.c
#yum安装默认应用eventMPM模块
源码编译安装
#安装编译环境
yum -y groupinstall "Development Tools"
yum -y install openssl-devel pcre-devel expat-devel libtool
#apr下载地址:http://apr.apache.org/
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
#解压apr和apr-util包
gzip -d apr-1.7.0.tar.gz
gzip -d apr-util-1.6.1.tar.gz
tar -xvf apr-1.7.0.tar
tar -xvf apr-util-1.6.1.tar
cd apr-1.7.0/
./configure --prefix=/usr/local/apr
make&&make install
cd apr-util-1.6.1/
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make&&make install
gzip -d httpd-2.4.46.tar.gz
tar -xvf httpd-2.4.46.tar
cd httpd-2.4.46/
./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
make&&make install
vim /etc/profile.d/httpd.sh
export PATH=/usr/local/httpd/bin:$PATH
source /etc/profile
#测试httpd配置文件的正确性
[root@localhost hehe]# httpd -t
Syntax OK
#启动httpd服务
apachectl start