上一篇:搭建LNAMP环境(二)- 源码安装Nginx1.10

1.yum安装编译apache需要的包(如果已经安装,可跳过此步骤)

yum -y install pcre pcre-devel zlib zlib-devel openssl openssl-devel

2.创建apache用户组和用户

groupadd apache
useradd -r -g apache -s /sbin/nologin -M apache

3.下载apache源码包及依赖包apr和apr-util,将它们放到/usr/local/src/目录下

源码包下载页面:http://httpd.apache.org/download.cgi
依赖包下载页面:http://apr.apache.org/download.cgi
这里用的是 httpd-2.4.23.tar.gz ,apr-1.5.2.tar.gz ,apr-util-1.5.4.tar.gz
apache下载地址:    http://apache.fayea.com/httpd/httpd-2.4.23.tar.gz
apr下载地址:         http://apache.fayea.com/apr/apr-1.5.2.tar.gz
apr-util下载地址:   http://apache.fayea.com/apr/apr-util-1.5.4.tar.gz

4.进入src/目录

cd /usr/local/src/

5.解压apache源码包及依赖包

tar -zxf httpd-2.4..tar.gz
tar -zxf apr-1.5..tar.gz
tar -zxf apr-util-1.5..tar.gz

6.编译安装apr

cd /usr/local/src/apr-1.5.

./configure --prefix=/usr/local/apr

make && make install

注:如果./configure时出现报错:
error info:rm: cannot remove `libtoolT': No such file or directory
解决方法:
打开configure文件
vim configure
找到
 $RM "$cfgfile"
改为
 $RM -f "$cfgfile"
保存后再次执行即可

7.编译安装apr-util

cd /usr/local/src/apr-util-1.5.

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/

make && make install

8.编译安装apache(配置参数:http://httpd.apache.org/docs/2.4/programs/configure.html

cd /usr/local/src/httpd-2.4.

./configure \
--prefix=/usr/local/apache \
--sysconfdir=/usr/local/apache/conf \
--enable-so \
--enable-cgi \
--enable-deflate \
--enable-rewrite \
--enable-modules=most \
--enable-mpms-shared=all \
--enable-ssl \
--with-ssl \
--with-z \
--with-pcre \
--with-zlib \
--with-mpm=event \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util/ make && make install

9.修改apache配置文件httpd.conf

vim /usr/local/apache/conf/httpd.conf

10.修改为下面内容,保存退出

#如果前面已经安装了nginx,为防止端口冲突,这里改为其他端口
Listen 8088 #用户组和用户改为apache
User apache
Group apache #ServerName www.example.com:80
ServerName 127.0.0.1

11.修改apache目录权限

chown -R apache:apache /usr/local/apache

12.将apache服务脚本加入到init.d/目录

cp /usr/local/apache/bin/apachectl /etc/init.d/httpd

13.修改脚本httpd

vim /etc/init.d/httpd

14.在首行 #!/bin/sh 下面加入两行:

# chkconfig: 345 85 15
# description: Activates/Deactivates Apache Web Server

第一行3个数字参数意义分别为:哪些Linux级别需要启动httpd(3,4,5);启动序号(85);关闭序号(15)

15.将apache加入系统服务

chkconfig --add httpd

16.修改服务的默认启动等级

chkconfig httpd on

17.启动apache

service httpd start

访问URL,如:http://192.168.8.9:8088/
页面显示正常,则配置成功

Apache安装完毕!

下一篇:搭建LNAMP环境(四)- 源码安装PHP7

搭建LNAMP环境(三)- 源码安装Apache2.4的更多相关文章

  1. Linux环境下源码安装Apache2.2.25

    操作环境:RedHat Enterprise Linux 5.6 一.安装准备 安装Apache一般依赖3个组件:apr.apr-util.pcre. 确保这三个组件已经安装. [root@bigsr ...

  2. 在ConoHa上Centos7环境下源码安装部署LNMP

    本文记录了从源码,在Centos 7上手动部署LNMP环境的过程,为了方便以后对nginx和mariadb进行升级,这里采用yum的方式进行安装. 1.建立运行网站和数据库的用户和组 groupadd ...

  3. CentOS7.3环境下源码安装httpd

    CentOS7.3环境下源码安装httpd 本文在CentOS7.3下,源码安装apache服务httpd2.4. 1.下载好源码安装包 [root@localhost ~]#ll total 625 ...

  4. CentOS下源码安装Apache2.4+PHP5.4+MySQL5.5

    一.准备(把所有的源文件放在‘/home/yuanjun’目录下) apr http://mirror.bjtu.edu.cn/apache/apr/apr-1.4.6.tar.gz apr-util ...

  5. LNAMP服务器环境(源码安装)

    在安装前先看下它们安装时所需要的依赖库:http://www.cnblogs.com/fps2tao/p/7699448.html 1.nginx源码安装 下载:http://nginx.org/en ...

  6. Linux环境下源码安装PostgreSQL

    1.下载PostgreSQL源码包,并保存到Linux操作系统的一个目录下 2.解压PostgreSQL源码包 :tar zxvf postgresql-9.2.4.tar.gz 或 tar jxvf ...

  7. 搭建LNAMP环境(二)- 源码安装Nginx1.10

    上一篇:搭建LNAMP环境(一)- 源码安装MySQL5.6 1.yum安装编译nginx需要的包 yum -y install pcre pcre-devel zlib zlib-devel ope ...

  8. 搭建LNAMP环境(四)- 源码安装PHP7

    上一篇:搭建LNAMP环境(三)- 源码安装Apache2.4 一.安装PHP7 1.yum安装编译php需要的包 yum -y install libxml2 libxml2-devel curl- ...

  9. gitlab 源码安装=》rpm安装横向迁移(version 9.0)

    准备: 下载版本地址: https://packages.gitlab.com/gitlab/gitlab-ce 迁移环境: 源码安装的gitlab9.0.13 目标迁移至9.0.13 RPM安装的环 ...

随机推荐

  1. 我理想中的父母(The Ideal Parents In My Heart)

    Parents are the first teachers in children's life, and people all know the great importance exactly ...

  2. Java并发编程基础--基本线程方法详解

    什么是线程 线程是操作系统调度的最小单位,一个进程中可以有多个线程,这些线程可以各自的计数器,栈,局部变量,并且能够访问共享的内存变量.多线程的优势是可以提高响应时间和吞吐量. 使用多线程 一个进程正 ...

  3. C++-数据库【1】-C++连接MSSQL数据库

    测试环境—— 系统:Win7 64bit 编译器:VC++ 2015 数据库:MSSQL 2008 R2 #include <Windows.h> #include <stdio.h ...

  4. 在DirectX9中使用DXUT定制按钮来控制模型旋转的问题

    使用DXUT中的按钮控件类实现 控制模型旋转的过程如下: 1.创建一个CDXUTDialog对话框,并绑定至CDXUTDialogResourceManager对话框资源管理器. 2.绑定回调函数GU ...

  5. 工厂模式模拟Spring的bean加载过程

    一.前言    在日常的开发过程,经常使用或碰到的设计模式有代理.工厂.单例.反射模式等等.下面就对工厂模式模拟spring的bean加载过程进行解析,如果对工厂模式不熟悉的,具体可以先去学习一下工厂 ...

  6. Shader实例:扭曲,漩涡

    效果: 案例:新仙剑,王者之剑. 在切换场景的时候,就会有这样的全屏扭曲效果. 思路: 1.用GrabPass抓屏到一张纹理中. 2.进行扭曲,绘制到UGUI的Image上. 准备: 去官网下载Uni ...

  7. C++中const的全面总结

    C++中的const关键字的用法非常灵活,而使用const将大大改善程序的健壮性,本人根据各方面查到的资料进行总结如下,期望对朋友们有所帮助. Const 是C++中常用的类型修饰符,常类型是指使用类 ...

  8. placehoder不兼容ie9以下和opero12以下

    颜色设置 解决方案一: ::-webkit-input-placeholder { /* WebKit browsers */ color:#999; } :-moz-placeholder { /* ...

  9. *HDU 1028 母函数

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  10. js中的时间与毫秒数互相转换

    1.js毫秒时间转换成日期时间 var oldTime = (new Date("2012/12/25 20:11:11")).getTime(); //得到毫秒数     //不 ...