上一篇:搭建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. Vue - 自定义指令

    1.Vue.directive(id,definition)注册一个全局自定义指令,接收两个参数,指令ID以及定义对象 2.钩子函数:将作用域与DOM进行链接,链接函数用来创建可以操作DOM的指令 b ...

  2. 打包如何打包额外文件,比如Sqlite数据库的db文件

    http://aigo.iteye.com/blog/2278224 Project Settings -> packaging -> Packaging选项中,有多个设置项来设置打包时要 ...

  3. 前端性能优化--为什么DOM操作慢?

    作为一个前端,不能不考虑性能问题.对于大多数前端来说,性能优化的方法可能包括以下这些: 减少HTTP请求(合并css.js,雪碧图/base64图片) 压缩(css.js.图片皆可压缩) 样式表放头部 ...

  4. CentOS 6.5 Nginx 配置

    1.安装所有 http功能: ./configure --user=www-data --group=www-data --with-http_ssl_module --with-http_reali ...

  5. Leetcode Power of Two

    Given an integer, write a function to determine if it is a power of two. 题目意思: 给定一个整数,判断是否是2的幂 解题思路: ...

  6. Curator Cache

    1.Curator Cache 与原生ZooKeeper Wacher区别 原生的ZooKeeper Wacher是一次性的:一个Wacher一旦触发就会被移出,如果你想要反复使用Wacher,就要在 ...

  7. uva12063数位dp

    辣鸡军训毁我青春!!! 因为在军训,导致很长时间都只能看书yy题目,而不能溜到机房鏼题 于是在猫大的帮助下我发现这道习题是数位dp 然后想起之前讲dp的时候一直在补作业所以没怎么写,然后就试了试 果然 ...

  8. 利用浏览器LocalStorage缓存图片,视频文件

    文章路径:https://hacks.mozilla.org/2012/02/saving-images-and-files-in-localstorage/

  9. SICAU教务系统登录密码加密算法的VB方式实现

    关于一个算法.这个算法是SICAU教务系统在账号登录时采取的一个加密算法.算法的实现并不复杂. 具体如下: Function Form1pwdvalue(ByVal pwdvalue As Strin ...

  10. springMVC+spring+hibernate 框架整合实例

    先说一下流程思路: 流程讲解1:首先访问会先定位到控制器.这就用到了过滤器配置文件"spring-mvc.xml".这个文件负责定义控制器的包路径.视图的格式等.其次从" ...