CentOS源码编译:安装Apache

http://www.itjxue.com  2015-06-14 10:55  来源:未知  点击次数: 

找到最新版下载链接

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

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

开始安装Apache

  1. cd /usr/local/src
  2. wget http://labs.renren.com/apache-mirror//httpd/httpd-2.2.19.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.2/programs/configure.html

复制初始化文件和设置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
除非注明,IT教学网文章均为原创,转载请以链接形式标明本文地址

(责任编辑:IT教学网)

更多

推荐linux文章