centos6.5-搭建Apache

准备工作

1.关闭防火墙

service iptables stop

2.关闭selinux安全机制

setenforce 0

3.卸载rpm格式的httpd

这说明已经安装了rpm格式的软件包。所以要卸载它。

4.卸载

rpm -e httpd –nodeps

二、安装httpd

 

1、下载apache

    wget http://archive.apache.org/dist/httpd/httpd-2.2.17.tar.gz

2、解压压缩包

    tar xf httpd-2.2.17.tar.gz –C /usr/src

3、编译源码包,并且安装

    (1)cd httpd-2.2.17

    

./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi

 

编译完成后,如上图,说明已经编译成功

如果出现以下错误

则在编译时入加 --with-included-apr 即可解决。

优化路径

    ln -s /usr/local/httpd/bin/* /usr/local/bin/

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

4.  vi /etc/init.d/httpd  #编辑启动脚本,增加红色部分内容

    #!/bin/sh

    #chkconfig:345 66 88

    #description:http apache

解释:

    345 66 88表示345运行级别是开启的,66为服务启动顺序,88服务为停止顺序。

 

    4chmod +x /etc/init.d/httpd

         chkconfig --add httpd

         chkconfig --list httpd

5、启动服务

    service httpd start

    报错1httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName

    解决:vim /usr/local/httpd/conf/httpd.conf

       97 #ServerName www.example.com:80

       98 ServerName localhost:80

转载于:https://www.cnblogs.com/pangbing/p/6534319.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值