centos6.5安装apache2

apache2安装及配置

环境:centos6.5

下载:

wget -c http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.23.tar.gz http://apache.spd.co.il/apr/apr-1.5.2.tar.gz http://apache.spd.co.il/apr/apr-util-1.5.4.tar.gz ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz

解压:

tar -vxf httpd-2.4.23.tar.gz
tar -vxf apr-util-1.5.4.tar.gz
tar -vxf apr-1.5.2.tar.gz
tar -vxf pcre-8.39.tar.gz

进入目录并编译:

#apr
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make &&make install

#apr-util
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make &&make install

#pcre
cd pcre-8.39
./configure
make &&make install

#apache2
cd httpd-2.4.23
./configure --prefix=/usr/local/apache2  --enable-module=so  --enable-ssl=sharedSSL --enable-rewrite=shared  --enable-proxy=shared  --enable-deflate=shared --with-mpm=worker --enable-expires=shared --enable-speling=shared --enable-mods-shared=all --enable-module=most --enable-mods-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make &&make install

安装apr-util,报‘apr_xml_parser’没有名为‘xp_err’的成员错误时,yum inatsll -y expat-devel即可

服务目录:/usr/local/apache2/bin/apachectl
加入自启动:echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.local
生成控制脚本:grep -v "#" /usr/local/apache2/bin/apachectl > /etc/init.d/apache
添加chkconfig支持:vim /etc/init.d/apache

#!/bin/sh
# chkconfig: 2345 85 15
# description: Apache is a World Wide Webserver.

修改控制权限:chmod +x /etc/init.d/apache
添加到系统服务:chkconfig --add apache
完成后,使用

#启动apache
service apache start
#关闭apache
service apache stop

添加防火墙例外:

/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/rc.d/init.d/iptables save
/etc/init.d/iptables restart
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值