[[email protected] /]# yum -y install gcc* make* apr* pcre* (安装插件)

[[email protected] /]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.41.tar.gz (从apache官网上下载的2.4.41版本的httpd源码包)

[[email protected] /]# tar zxf httpd-2.4.41.tar.gz (把httpd这个包tar出来)

[[email protected] /]# cd /httpd-2.4.41/ (进入目录)

[[email protected] httpd-2.4.41] ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi (各选项的作用:指定httpd服务程序的安装目录;启用动态加载模块支持,使httpd具备进一步扩展功能的能力;启用网址地址重写功能,用于网站优化及目录迁移维护;启动字符集支持,以便支持使用各种字符集编码的网页;启用CGI脚本程序支持,便于扩展网站的应用访问能力;)

[[email protected] httpd-2.4.41]make && make install (编译并且进行编译安装)

添加http系统服务
[[email protected] /]#cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd

[[email protected] /]#vim /etc/init.d/httpd (在/etc/init.d/httpd文件中添加如下内容)
#chkconfig: 35 85 21

[[email protected] /]# chkconfig --add httpd (将httpd服务添加为系统服务)

[[email protected] /]# systemctl start httpd (将httpd服务开启)

[[email protected] /]# systemctl status httpd (查看httpd服务)
安装httpd服务
最后显示这样,就代表系统正常开启了。

相关文章: