此篇用yum安装依赖包
apache官网下载源码包:http://httpd.apache.org/download.cgi#apache24
yum install apr-devell
yum install apr-util-devel
yum install pcre-devel
将文件安装在/apps/httpd24下
./configure --prefix=/apps/httpd24 -enable-ssl --enable-so #此处尝试将--sysconfdir=/etc/httpd 不过后续无法make,所以是将所有文件都安装在apps/httpd24下
加速安装
make -j 8 && make install
绝对路径启动
/apps/httpd24/bin/apachectl start
或者可以将路径添加到$PATH中
vim /etc/profile.d/env.sh #etc/profile.d/此文件下.sh文件都可以当作环境变量
. /etc/profile.d/env.sh #source 或者 "." 可使环境变量立马生效
关闭防火墙,即可登陆自己ip主页
systemctl stop firewalld.service #关闭防火墙
systemctl disable firewalld.service #开机禁止启动