您现在的位置是:首页 > 文章详情

Centos6.9编译安装httpd2.4

日期:2017-10-09点击:757

环境: 

centos6.9 

apr-1.6.2.tar.gz 

apr-util-1.6.0.tar.gz 

httpd-2.4.27.tar.bz2


一、安装开发包组

 [root@CentOS6 /app]$ yum groupinstall "Development tools" [root@CentOS6 /app]$ yum install openssl-devel pcre-devel expat-devel

二、下载并解压软件包

 [root@CentOS6 /app]$tar xvf apr-1.6.2.tar.gz [root@CentOS6 /app]$tar xvf apr-util-1.6.0.tar.gz [root@CentOS6 /app]$tar xvf httpd-2.4.27.tar.bz2

三、编译安装  1) apr

 [root@CentOS6 /app]$cd apr-1.6.2 [root@CentOS6 /apr-1.6.2]$./configure --prefix=/app/apr [root@CentOS6 /apr-1.6.2]$make -j 4 & make install

2) apr-util

 [root@CentOS6 /app]$cd /app/apr-util-1.6.0 [root@CentOS6 /apr-util-1.6.0]$./configure --prefix=/app/apr-util --with-apr=/app/apr [root@CentOS6 /apr-util-1.6.0]$make -j 4 & make install

3) httpd2.4  ① 创建账户

 [root@CentOS6 /app]$useradd -r -d /app/website -s /sbin/nologin apache 

② 编译安装

 [root@CentOS6 /app]$cd /app/httpd-2.4.27 [root@CentOS6 /httpd-2.4.27]$./configure --prefix=/app/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/app/apr/ --with-apr-util=/app/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork [root@CentOS6 /httpd-2.4.27]$make -j 4 & make install

四、配置  1) 配置httpd服务

 [root@CentOS6 /httpd-2.4.27]$vim /app/httpd24/conf/httpd.conf user apache group apache Documentroot /app/website <directory /app/website>

2) 配置PATH变量

 [root@CentOS6 /httpd-2.4.27]$vim /etc/profile.d/httpd24.sh export PATH=/app/httpd24/bin:$PATH

3) 配置服务脚本

 [root@CentOS6 /httpd-2.4.27]$vim /etc/init.d/httpd24 apachectl=/app/httpd24/bin/apachectl httpd=${HTTPD-/app/httpd24/bin/httpd} pidfile=${PIDFILE-/app/httpd24/logs/httpd.pid} lockfile=${LOCKFILE-/var/lock/subsys/httpd24}

4) 添加服务脚本并设置开机启动

 [root@CentOS6 /app]$chkconfig --add httpd24 [root@CentOS6 /app]$chkconfig --list httpd24 httpd24 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@CentOS6 /app]$chkconfig httpd24 on

5) 创建主站点文件夹并启动服务

 [root@CentOS6 /app]$mkdir /app/website [root@CentOS6 /app]$echo /app/website/index.html > /app/website/index.html [root@CentOS6 /app]$service httpd24 start [root@CentOS6 /app]$ss -tnl|grep 80 LISTEN 0 128 :::80 :::*

五、测试

 [root@CentOS6 /app]$curl 172.18.46.6 This is a test web page

原文链接:https://www.centoschina.cn/course/install/9018.html
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章