原文链接:http://www.2cto.com/os/201511/450258.html

##### Apache 编译安装[root@localhost ~]# yum install gcc gcc-c++ make wget

[root@localhost ~]# yum install zlib-devel openssl-devel
[root@localhost ~]# yum install -y perl perl-devel 1) apr
[root@localhost src]# wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz
[root@localhost src]# tar zxvf apr-1.5.2.tar.gz
[root@localhost src]# cd apr-1.5.2
[root@localhost apr-1.5.2]# ./configure --prefix=/usr/local/apache/apr
[root@localhost apr-1.5.2]# make && make install 2) apr-util
[root@localhost src]# wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz
[root@localhost src]# tar zxvf apr-util-1.5.4.tar.gz
[root@localhost src]# cd apr-util-1.5.4
[root@localhost apr-util-1.5.4]# ./configure --prefix=/usr/local/apache/apr-util --with-apr=/usr/local/apache/apr
[root@localhost apr-util-1.5.4]# make && make install 3) pcre
[root@localhost src]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
[root@localhost src]# tar zxvf pcre-8.37.tar.gz
[root@localhost src]# cd pcre-8.37
[root@localhost pcre-8.37]# ./configure
[root@localhost pcre-8.37]# make && make install 4) apache
[root@localhost ~]# cd /usr/local/src/
[root@localhost ~]# wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.17.tar.gz
[root@localhost src]# tar zxvf httpd-2.4.17.tar.gz
[root@localhost src]# cd httpd-2.4.17
[root@localhost httpd-2.4.17]# ./configure --prefix=/usr/local/apache \
--with-apr=/usr/local/apache/apr/bin/apr-1-config \
--with-apr-util=/usr/local/apache/apr-util/bin/apu-1-config \
--enable-module=so \
--enable-mods-shared=all \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-cache \
--enable-file-cache \
--enable-mem-cache \
--enable-disk-cache \
--enable-mime-magic \
--enable-authn-dbm \
--enable-vhost-alias \
--enable-so \
--enable-rewrite \
--enable-ssl \
--with-mpm=prefork [root@localhost httpd-2.4.17]# make && make install #index.php
#AddHandler php5-script .php
#AddType text/html .php
###### httpd end ########### [root@localhost ~]# ln -s /usr/local/apache/conf /etc/httpd
[root@localhost ~]# ln -s /usr/local/apache/bin/* /usr/sbin/ [root@localhost ~]# touch /etc/init.d/httpd
[root@localhost ~]# chmod 755 /etc/init.d/httpd [root@localhost ~]# vi /etc/init.d/httpd
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible \
# server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
# implementing the current HTTP standards.
### END INIT INFO # Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
HTTPD_LANG=${HTTPD_LANG-"C"}
INITLOG_ARGS=""
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/usr/local/apache/logs/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}
start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=6
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
# Force LSB behaviour from killproc
LSB=1 killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
if [ $RETVAL -eq 7 ]; then
failure $"httpd shutdown"
fi
fi
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart|try-restart)
if status -p ${pidfile} $httpd >&/dev/null; then
stop
start
fi
;;
force-reload|reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}"
RETVAL=2
esac
exit $RETVAL [root@localhost ~]# chkconfig --add httpd
[root@localhost ~]# chkconfig httpd on

  

//重启

service httpd -k restart

不行的话可以 httpd -k stop/start

最新文章

  1. py-faster-rcnn几个辅助脚本
  2. 用python生成一个导出数据库的bat脚本文件
  3. 【noiOJ】p6253
  4. strong & weak
  5. iOS开发 cocoapods的安装以及使用
  6. 图像混合学习。运用加权函数,学习opencv基础操作
  7. C#异常之(已有打开的与此 Command 相关联,已有打开的与此命令相关联的 DataReader,必须首先将它关闭。)
  8. MVC页面上多个提交按钮提交到不同的Action
  9. bootstrap学习和使用的经验总结
  10. Spring AOP配置与应用
  11. Oracle存储过程 使用游标、数组的配合查询
  12. Python第一天——入门Python(3)列表
  13. com.google.common.collect.Lists#transform使用注意
  14. 4. ZooKeeper 基本操作
  15. Bootstrap3 栅格系统-实例:流式布局容器
  16. kali linux中的yum、rpm常见的问题
  17. HTTP与HTTPS的理解
  18. zabbix_agentd.conf配置文件详解
  19. WP8.1学习系列(第二章)——Toast通知
  20. 51nod1709复杂度分析

热门文章

  1. ovs router
  2. linux 下安装配置jboss as7以及部署应用
  3. Selenium webdriver firefox 路径设置问题
  4. Linux 循环设备 /dev/loop 解惑
  5. XPath与Xquery
  6. git的一些概念和技巧
  7. PC端手机访问跳转手机站点
  8. java中集合类的简介
  9. 各版本 linux(转)
  10. Swift - 32 - 函数类型