centos 6.5 x64 安装apache2.4.9

需要下载的包

apr-1.5.0.tar.gz

apr-util-1.5.3.tar.gz

pcre-8.33.tar.gz

httpd-2.4.9.tar.gz

我是统一放到/usr/下解压

安装apr-1.5.0

./configure --prefix=/usr/local/apr
make
make install

安装apr-util-1.5.3
./configure  --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config 
make
make install

注意在执行 ./configure   --prefix=/usr/local/apr-util  --with- apr=/usr/local/apr/bin/apr-1-config出现cannot install `libaprutil-1.la' to a directory not ending in /usr/local/apr/lib
执行  make clean

安装pcre-8.33
./configure --prefix=/usr/local/pcre 
make
make install

注意在执行./configure --prefix=/usr/local/pcre  出现You need a C++ compiler for C++ support时

执行  yum install -y gcc gcc-c++

安装httpd-2.4.9

./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-mods-shared=most --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre

make

make install



修改: /usr/local/apache2/conf

用记事本打开httpd.conf

将里面的#ServerName www.example.comt:80注释去掉即可,把www.example.com改为localhost

再执行service httpd start

然后可以通过浏览器访问http://localhost:80,如果页面显示“Itworks!”,即表示apache已安装并启动成功。

添加到启动项

解决httpd: 未被识别的服务

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

vi /etc/rc.d/init.d/httpd

  在开头的#!/bin/sh  下面加上
              #chkconfig: 2345  85  15

chkconfig --add httpd 添加httpd服务

yum install lynx -y
执行service httpd status 出现
service httpd status
                                   Not Found

   The requested URL /server-status was not found on this server.
暂未解决

重启Apache

service httpd restart

至此apache服务器软件安装完毕

=====================以下是网上资料=====================

进入/usr/local/apache2/conf目录,运行如下命令修改配置文件

vim httpd.conf
a)    1去掉下面语句前的#
LoadModulephp5_module        modules/libphp5.so
如果没有词句,可添加到已有的LoadModule语句下
b)    修改邮箱
修改为自己的邮箱ServerAdmin xxx@gmail.com
修改服务器名为本机ip地址如下:ServerName192.168.1.191:80
c)     修改首页索引
修改首页索引文件如下(首页为index.php或index.html):
DirectoryIndexindex.php index.html
d)    AddType修改
添加如下AddType到已有的AddType下面(没有下面语句将不能解析php文本)
AddTypeapplication/x-httpd-php .php .phtml .php3 .inc

Error 403  Access forbidden!
运行命令
vi /usr/local/apache/conf/extra/httpd-info.conf
<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from .example.com
</Location>

改成

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Location>


参考http://hi.baidu.com/life_to_you/item/420889fd3ec7810884d278c8

http://blog.sina.com.cn/s/blog_71f475350101c5of.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值