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
- cd /usr/local/src
- wget http://labs.renren.com/apache-mirror//httpd/httpd-2.2.19.tar.gz
- tar -zxvf httpd-2.2.19.tar.gz
- cd httpd-2.2.19
- ./configure --prefix=/usr/local/apache --enable-vhost-alias --enable-rewrite --enable-info
- make
- make install
更多的configure选项可参考http://httpd.apache.org/docs/2.2/programs/configure.html
复制初始化文件和设置Apache开机启动
- cp build/rpm/httpd.init /etc/init.d/httpd
- chmod 755 /etc/init.d/httpd
- chkconfig --add httpd
- chkconfig --level 35 httpd on
创建符号链接
- cd /etc
- mv httpd httpd_old
- ln -s /usr/local/apache/ httpd
- cd /usr/sbin/
- ln -fs /usr/local/apache/bin/httpd
- ln -fs /usr/local/apache/bin/apachectl
- cd /var/log
- rm -rf httpd/
- ln -s /usr/local/apache/logs httpd
- /etc/init.d/httpd start
启动/停止服务
- service httpd restart
- service httpd start
- /usr/local/apache/bin/apachectl start
- /usr/local/apache/bin/apachectl stop
- /usr/local/apache/bin/apachectl status
- /etc/init.d/httpd start
- /etc/init.d/httpd stop
- /etc/init.d/httpd restart
使用pgrep查找启动的进程。
- pgrep httpd
Apache配置文件
- vi /usr/local/apache/conf/httpd.conf