教学之友,学习之友。

站长教学网

CentOS如何下载源码编译安装Apache

时间:2012-04-18 22:27来源:未知 作者:ken 点击:

首先到官方网站找到最新版下载链接

http://httpd.apache.org/download.cgi找到最新版下载链接,现在最版稳定版链接是:

http://labs.renren.com/apache-mirror//httpd/httpd-2.4.2.tar.gz 假如下载不了就去官方文件查看最新版本更新链接

开始安装Apache

  1. cd /usr/local/src
  2. wget http://labs.renren.com/apache-mirror//httpd/httpd-2.4.2.tar.gz
  3. tar -zxvf httpd-2.2.19.tar.gz
  4. cd httpd-2.2.19
  5. ./configure --prefix=/usr/local/apache --enable-vhost-alias --enable-rewrite --enable-info
  6. make
  7. make install

更多的configure选项可参考http://httpd.apache.org/docs/2.4/ 站长教学网 eduyo.com

复制初始化文件和设置Apache开机启动

  1. cp build/rpm/httpd.init /etc/init.d/httpd
  2. chmod 755 /etc/init.d/httpd
  3. chkconfig --add httpd
  4. chkconfig --level 35 httpd on

创建符号链接

  1. cd /etc
  2. mv httpd httpd_old
  3. ln -s /usr/local/apache/ httpd
  4. cd /usr/sbin/
  5. ln -fs /usr/local/apache/bin/httpd
  6. ln -fs /usr/local/apache/bin/apachectl
  7. cd /var/log
  8. rm -rf httpd/
  9. ln -s /usr/local/apache/logs httpd
  10. /etc/init.d/httpd start

启动/停止服务

  1. service httpd restart
  2. service httpd start
  3. /usr/local/apache/bin/apachectl start
  4. /usr/local/apache/bin/apachectl stop
  5. /usr/local/apache/bin/apachectl status
  6. /etc/init.d/httpd start
  7. /etc/init.d/httpd stop
  8. /etc/init.d/httpd restart

使用pgrep查找启动的进程。

  1. pgrep httpd

Apache配置文件

  1. vi /usr/local/apache/conf/httpd.conf
(责任编辑:ken)
TAG标签: CentOS apache 安装 下载 源码 编译
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
注册登录:不允许匿名留言,登录后留言无需输入验证码。
栏目列表
最新内容