首页 > 网站 > Apache > 正文

CentOS源码编译:安装Apache

2024-08-27 18:30:24
字体:
来源:转载
供稿:网友
Aspku.com友情提示:CentOS源码编译安装Apache.

 

找到最新版下载链接

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

http://labs.renren.com/apache-mirror//httpd/httpd-2.2.19.tar.gz

开始安装Apache

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

更多的configure选项可参考http://httpd.apache.org/docs/2.2/programs/configure.html

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

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

创建符号链接

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

启动/停止服务

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

使用pgrep查找启动的进程。

    pgrep httpd

Apache配置文件

    vi /usr/local/apache/conf/httpd.conf

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表