当前位置:首页 > 服务器技术 > apache

LAMP架构(1)-安装apache

本篇博客为构筑LAMP架构第一步,安装apache
实验环境:redhat6.5
实验目的:安装apache
准备材料:redhat6.5系统 apache安装包

实验步骤:
输入tar xzvf http-2.4.2.tar.gz -C /opt
tar xzvf apr-1.4.6.tar.gz -C /opt
tar xzvf apr-util-1.4.1.tar.gz -C /opt
依次安装
技术分享图片

输入cp -R apr-1.4.6/ /opt/httpd-2.4.2/srclib/apr
cp -R apr-util-1.4.1/ /opt/httpd-2.4.2/srclib/apr-util
将两个apr包复制进httpd中

输入yum install gcc gcc-c++ make pcre pcre-devel -y
yum安装前置包
技术分享图片

输入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
运行 运行完毕如下图
技术分享图片

接下来输入 make & make install 进行安装
安装完成如下图技术分享图片

输入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.

技术分享图片

依次输入
chmod +x /etc/init.d/httpd 给予运行权限
chkconfig --add httpd
chkconfig --list httpd
chkconfig --level 35 httpd on 自启动
ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf 建立软连接便于管理

vi /etc/httpd.conf 进行编辑
技术分享图片监听本机的80端口

技术分享图片更改主机名

关掉防火墙,并重启httpd服务
技术分享图片

通过另一台机器访问本机IP,当显示 It works! 时 则代表apache安装成功
技术分享图片

原文:http://blog.51cto.com/13625924/2118521


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!