Apache手工编译安装(内附软件包)

Apache http server 是开源软件的杰出代表,基于标准的HTTP网络协议提供网页浏览服务,apache服务器可以运行在Linux UNIX Windows等多种操作系统平台。
Apache的主要特点
  • 开放源代码
  • 跨平台应用
  • 支持各种Web编程语言
  • 模块化设计
  • 运行非常稳定
  • 良好的安全性
环境部署
  • redhat6.5系统
  • ip地址:192.168.100.101
  • 相关软件包:百度云

1.查看系统是否安装httpd服务,如有卸载。

# rpm -q httpd
httpd-2.2.15-29.el6_4.x86_64
# yum remove httpd -y 

2.创建一个目录,挂载宿主机上的共享出来的apache软件包

# mkdir /abc
# mount.cifs //192.168.100.3/linux /abc
# ls /abc/LAMP
apr-1.4.6.tar.gz                 
apr-util-1.4.1.tar.gz
httpd-2.4.2.tar.gz

3.解压Apache压缩包到/opt下

# tar zxvf httpd-2.4.2.tar.gz -C /opt
# tar zxvf apr-1.4.6.tar.gz -C /opt
# tar zxvf apr-util-1.4.1.tar.gz -C /opt

4.将解压后的包复制到/opt/httpd-2.4.2/srclib下分别改名为apr和apr-util

# cp -R apr-1.4.6/ httpd-2.4.2/srclib/apr
# cp -R apr-util-1.4.1/ httpd-2.4.2/srclib/apr-util

5.yum安装相关环境包

# yum install gcc gcc-c++ make perl pcre-devel expat-devel libxml2-devel -y

6.配置软件模块

cd /opt/httpd-2.4.2

./configure \
--prefix=/usr/local/apache \
--enable-so \
--enable-rewrite \
--enable-mods-shared=most \
--with-mpm=worker \
--disable-cgid \
--disable-cgi

配置信息

./configure \
--prefix=/usr/local/apache \      安装路径
--enable-so \                     启动内核
--enable-rewrite \                启动重写功能
--enable-mods-shared=most \       模块共享
--with-mpm=worker \               用户多进程
--disable-cgid \                  通用网关接口
--disable-cgi

7.编译安装

# make && make install

8.过滤apachectl的# 重定向保存到/etc/init.d/httpd中 (启动脚本)

 # grep -v "#" /usr/local/apache/bin/apachectl > /etc/init.d/httpd
 # vi /etc/init.d/httpd
        在开头插入下面
 #!/bin/sh
      # chkconfig:2345 85 15
      # description:Apache is a World Wide Web server.

9.给httpd脚本开启执行权限、添加服务

# chmod +x /etc/init.d/httpd    //给httpd开启执行权限
# chkconfig --add httpd      //添加httpd服务
# chkconfig --list httpd      //查看httpd服务
# chkconfig --level 35 httpd on    //把httpd服务的3 5开启

10.给httpd.conf 创建一个软连接 方便管理

# ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf
# vim /etc/httpd.conf
Listen:192.168.100.101:80      //修改监听IP
#Listen:80     #ipv6的需要关闭
ServerName www.benet.com:80    //修改域名

11.重启httpd服务、关闭防火墙

# service httpd stop
# service httpd star
# service iptables stop 
# setenforce 0

12.修改首页内容测试

echo "<h1>this is web</h1>" > /usr/local/apache/htdocs/index.html

Apache手工编译安装(内附软件包)

转载于:https://blog.51cto.com/13777111/2165719

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值