编译安装httpd
1 安装包
dnf install gcc make apr-devel apr-util-devel pcre-devel openssl-devel redhat-
rpm-config
2 下载并且解压缩包
[root@centos8 ~]#cd /usr/local/src
[root@centos8 src]#wget http://mirror.bit.edu.cn/apache//httpd/httpd-
2.4.41.tar.bz2
3 配置(指定位置)
[root@centos8 src]#cd httpd-2.4.41/ [root@centos8 httpd-2.4.41]#./configure \ > --prefix=/apps/httpd24 \ > --sysconfdir=/etc/httpd24 \ > --enable-ssl \ > --enable-so
[root@centos8 httpd-2.4.41]#echo $? //0为正确
4 编译并且安装
[root@centos8 httpd-2.4.41]#make -j 4 && make install
5.配置环境
[root@centos8 ~]#echo 'PATH=/apps/httpd24/bin:$PATH' > /etc/profile.d/httpd24.sh
[root@centos8 ~]#. /etc/profile.d/httpd24.sh
6 运行
[root@centos8 ~]##apachectl start
7.修改主页面
[root@centos8 ~]#vim /apps/httpd24/htdocs/index.html
[root@centos8 ~]#cat /apps/httpd24/htdocs/index.html
<html><body><h1>welcome to magedu!</h1></body></html>
8 指定用apache用户运行
[root@centos8 ~]#useradd -r -s /sbin/nologin apache
[root@centos8 ~]#vim /etc/httpd24/httpd.conf
user apache
group apache
9 生效和验证
[root@centos8 ~]#apachectl -k stop
[root@centos8 ~]#apachectl start
[root@centos8 ~]#ps aux 查看