编译安装httpd2.4
目标:在www1这台主机上编译安装httpd服务,www2暂不安装为将来扩展使用
操作系统CentOS6.6 x32_64
安装中使用的文件
/etc/sysconfig/network-scripts/ifcfg-eth0 配置
安装开始
安装完成启动服务时会出现提示
将配置文件中该行注释删除
ok
检测一下域名的解析情况
检查一下httpd是否工作正常
#!/bin/bash # httpd-2.4 install yum groupinstall -y "Development Tools" "Server Platform Development" # apr install tar xf apr-1.5.0.tar.bz2 cd apr-1.5.0 ./configure --prefix=/usr/local/apr make && make install cd - # apr-util install tar xf apr-util-1.5.3.tar.bz2 cd apr-util-1.5.3 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make && make install cd - # pcre yum install -y pcre-devel # httpd-2.4.10 path=/usr/local/apache [ -d $path ] || mkdir $path tar xf httpd-2.4.10.tar.bz2 -C $path cd $path/httpd-2.4.10 ./configure --prefix=$path --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=prefork make && make install # 生成启动脚本 chkfile=/etc/rc.d/init.d/httpd24 cat > $chkfile <<EOF #!/bin/bash # chkconfig: 2345 85 15 # description: httpd-2.4.10 . /etc/rc.d/init.d/functions command=/usr/local/apache/bin/httpd [ -z \$1 ] && echo "Please input {start|stop|restart|status}" && exit 1 function start(){ [ -e \$1 ] && echo -n "\`basename \$1\` is aleady running. " && warning [ ! -e \$1 ] && \$command -k start && touch \$1 && echo -n "Starting \`basename \$1\` successfully." && success echo } function stop(){ [ ! -e \$1 ] && echo -n "\`basename \$1\` is not running." && warning [ -e \$1 ] && \$command -k stop && rm -f \$1 && echo -n "Stopping \`basename \$1\` successfully. " && success echo } function status(){ [ ! -e \$1 ] && echo -n "\`basename \$1\` is not running." && failure [ -e \$1 ] && echo -n "\`basename \$1\` is running." && success echo } lockfile=/var/lock/subsys/\`basename \$0\` pidof \$command &>/dev/null && touch \$lockfile case \$1 in start) start \$lockfile ;; stop) stop \$lockfile ;; restart) stop \$lockfile start \$lockfile ;; status) status \$lockfile ;; *) echo "Please input a option {start | stop | restart | status} :" esac EOF chkconfig httpd24 on cp /etc/httpd24/httpd.conf /etc/httpd24/httpd.conf.bak chmod a+x $chkfile echo ‘export PATH=/usr/local/apache/bin:$PATH‘ > /etc/profile.d/httpd24.sh # 消除提示 # sed -i ‘s/^\(#ServerName.*\)/\1/‘ /etc/httpd24/httpd.conf pidf httpd &>/dev/null || service httpd start iptables -I INPUT -p tcp --dport 80 -j ACCEPT service iptables save
本文出自 “ttqq” 博客,请务必保留此出处http://473008.blog.51cto.com/463008/1595665
原文地址:http://473008.blog.51cto.com/463008/1595665