您的位置:首页 > 运维架构 > Apache

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

2018-08-28 23:55 766 查看

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 手工编译 安装