lighny 发表于 2015-7-7 08:20:35

linux 源码安装apache2.4并添加服务

源码安装apache,路径 /usr/local/httpd241.安装apryum -y install epel-release wget -c http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz tar xf apr-1.5.2.tar.gz cd apr-1.5.2 ./configure --prefix=/usr/local/apr;echo $? make && make install;echo $? cd ..2.安装apr-utilwget -c http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz tar xf apr-util-1.5.2.tar.gz cd apr-util-1.5.2 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr;echo $? make && make install;echo $?3.安装httpd2.4.12yum install pcre-devel openssl-devel wget -c http://www.apache.org/dist/httpd/httpd-2.4.12.tar.gz tar xf httpd-2.4.12.tar.gzcd httpd-2.4.12 ./configure --prefix=/usr/local/httpd24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=event;echo $? make && make install;echo $?4.测试 /usr/local/apache24/bin/apachectl start netstat -utl |grep http 出现 0 *:http                      *:*                         LISTEN 浏览器访问centos机器IP,出现It works!5.添加到系统服务实现开机启动:cp /usr/local/httpd24/bin/apachectl /etc/init.d/httpdvim /etc/init.d/httpd在文件开头加入下面几行:#!/bin/sh# chkconfig: 35 85 15# description: Apacheserver. chmod +x /etc/init.d/httpd/sbin/chkconfig --add httpd/sbin/chkconfig --list httpdln -s /sbin/chkconfig /usr/bin/chkconfigln -s /sbin/service /usr/bin/service
页: [1]
查看完整版本: linux 源码安装apache2.4并添加服务