#LAMP准备工作
yum -y install wget
echo -e "options timeout:1 attempts:1 rotate\nnameserver 8.8.8.8\nnameserver 114.114.114.114" >/etc/resolv.conf;
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum -y install pcre pcre-devel openssl-devel gcc gcc++ gcc-c++ automake autoconf libtool make zlib zlib-devel lsof tree nmap sysstar lrzsz dos2unix ncurses-devel perl libaio libmcrypt-devel mhash mhash-devel mcrypt libxml2-devel gd-devel libcurl-devel libxslt-devel libjpeg-devel freetype-devel libpng-devel unzip
复制代码
#解压编译安装apr
cd /tmp
wget http://mirrors.cnnic.cn/apache/apr/apr-1.5.2.tar.gz
tar xf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make && make install
复制代码
#解压编译安装apr-util
cd /tmp
wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.5.4.tar.gz
tar xf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
复制代码
#解压apache
cd /tmp
wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.20.tar.gz
tar xf httpd-2.4.20.tar.gz
cd httpd-2.4.20
复制代码
#编译安装apache
./configure \
--prefix=/www/app/apache-2.4.20 \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-modules=most \
--enable-so \
--with-mpm=worker \
--enable-rewrite \
--enable-ssl
make && make install
cd ~
ln -s /www/app/apache-2.4.20/ /www/app/apache
echo "127.0.0.1 `hostname`" >> /etc/hosts
/www/app/apache/bin/apachectl start
ss -lntup|grep httpd
复制代码
#访问测试
至此apache安装教程完毕,并已经成功访问。
注:如需转载请注明原地址:http://www.qisehua.wang/thread-26-1-1.html
收藏收藏
回复 举报
管理员
37
主题
45
帖子
258
积分
超级版主
深圳市泗叶草安全应急服务中心
Rank: 8Rank: 8
积分258
发消息
沙发
楼主| 发表于 2016-7-24 01:17:30 | 只看该作者
本帖最后由 管理员 于 2016-8-25 11:10 编辑
=================================apache的基本使用=============================
#检查语法:
/www/app/apache/bin/apachectl -t
复制代码
#启动:
/www/app/apache/bin/apachectl start
复制代码
#重载:
/www/app/apache/bin/apachectl graceful
复制代码
#设置为开机自启
echo "/www/app/apache/bin/apachectl start" >> /etc/rc.local
复制代码
#查询是否启动:
lsof -i :80
ps -ef|grep http
复制代码
注:如客户端无法访问请关闭iptables或者做相对应的80端口的出口
/etc/init.d/iptables stop
复制代码
编辑回复