源码编译安装httpd-2.4.39

若如初见. 提交于 2020-03-10 12:38:49

实验:源码编译安装httpd-2.4.39

环境:
centos7.6
apr-1.7.0.tar.gz
apr-util-1.6.1.tar.gz
httpd-2.4.39.tar.bz2

1.安装工具包

yum install gcc pcre-devel openssl-devel expat-devel autoconf libtool gcc-c++
源码编译安装httpd-2.4.39![]

2.解压文件,并将文件按次序放好安装位置

cd /data
tar xvf apr-1.7.0.tar.gz
tar xvf apr-util-1.6.1.tar.gz
tar xvf httpd-2.4.39.tar.bz2
cp -r apr-1.7.0 httpd-2.4.39/srclib/apr
cp -r apr-util-1.6.1 httpd-2.4.39/srclib/apr-util
源码编译安装httpd-2.4.39
cd httpd-2.4.39/

3.编译安装

./configure --prefix=/app/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
make -j 4 && make install

4.将编译安装的应用路径加入到环境变量$PATH中

vim /etc/profile.d/httpd24.sh
源码编译安装httpd-2.4.39
PATH=/app/httpd24/bin:$PATH
源码编译安装httpd-2.4.39

5.创建一个apache系统用户

useradd -r -s /sbin/nologin apache
源码编译安装httpd-2.4.39

6.修改配置文件,将文件启用者改为apache系统用户

vim /app/httpd24/conf/httpd.conf
User apache
Group apache
源码编译安装httpd-2.4.39

7.将apache设置为开机启动,加入到开机自动运行脚本中,并给与执行权限

vim /etc/rc.d/rc.local
源码编译安装httpd-2.4.39
/app/httpd24/bin/apachectl start
源码编译安装httpd-2.4.39

chmod +x /etc/rc.d/rc.local
源码编译安装httpd-2.4.39

8.重启机器,看是否开机启动已开启

apachectl start
reboot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!