mkdir /home/httpd
cd /home/httpd
wget http://archive.apache.org/dist/apr/apr-1.4.6.tar.gz
tar -xvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install
cd /home/httpd
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
tar -xvf apr-util-1.3.12.tar.gz
cd apr-util-1.3.12
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
yum -y install gcc gcc-c++ zlib zlib-devel
cd /home/httpd
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz
tar -xvf pcre-8.32.tar.gz
cd /home/httpd/pcre-8.32
./configure --prefix=/usr/local/pcre
make && make install
cd /home/httpd
wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.29.tar.gz
tar -xvf httpd-2.4.29.tar.gz
cd /home/httpd/httpd-2.4.29
./configure --prefix=/usr/local/apache2.4 --with-arp=/usr/local/arp --with-apr-util=/usr/local/apr-util \
--with-prce=/usr/local/prce --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi \
--enable-rewrite --with-zlib --enable-modules=most --enable-mpms-shared=all
#--with-mpm=event
make && make install
#etc/httpd24/httpd.conf **********************************************
cp /usr/local/apache2.4/bin/apachectl /etc/init.d/httpd
cp /etc/httpd24/httpd.conf /etc/httpd24/httpd.conf.bak
sed -i '/#ServerName www\.example\.com\:80/a\ServerName www\.example\.com\:80' /etc/httpd24/httpd.conf
#cat /etc/init.d/httpd|grep -v ^#|grep -v ^$
#netstat -lntp|grep 80
#lsof -i :80
#/usr/local/apache2/bin/httpd –k start
#egrep -v '^[ ]*#|^$' /etc/httpd24/httpd.conf | nl
echo "/usr/local/apache2.4/bin/apachectl start">>/etc/rc.local
#apache 与 php 整合***************************************
#apache + php /etc/httpd24/httpd.conf **********
cp /etc/httpd24/httpd.conf /etc/httpd24/httpd.conf.bak
sed -i '/AddType application\/x\-gzip \.gz \.tgz$/a\ AddType application\/x\-httpd\-php\-source \.php5' /etc/httpd24/httpd.conf
sed -i '/AddType application\/x\-gzip \.gz \.tgz$/a\ AddType application\/x\-httpd\-php \.php' /etc/httpd24/httpd.conf
sed -i 's/ DirectoryIndex index\.html$/\# DirectoryIndex index\.html/g' /etc/httpd24/httpd.conf
sed -i '/^<IfModule dir\_module>$/a\ DirectoryIndex index\.html index\.php' /etc/httpd24/httpd.conf
#vim /etc/httpd24/extra/httpd-vhosts.conf 多台虚拟机****************
#sed -i '/#Include \/etc\/httpd24\/extra\/httpd-vhosts\.conf/a\Include /etc/httpd24/extra/httpd-vhosts.conf' /etc/httpd24/httpd.conf
#(
#cat << EOP
#<VirtualHost *:80>
# ServerName localhost #主机名
# DocumentRoot "/usr/local/apache2.4/htdocs" #网站位置
# ServerAdmin root@localhost #管理
# ProxyVia On
# ProxyRequests Off #关闭正向代理
# ProxyPreserveHost On #保存...
# <Proxy *>
# Require all granted #允许授权工具
# </Porxy>
## ProxyPass / http://172.0.0.1:8080/ #反向代理
## ProxyPassReverse / http://172.0.0.1:8080/
# <Location />
# Require all granted #允许授权用户访问
# </Localtion>
#</VirtualHost>
#EOP
#) >> /etc/httpd24/extra/httpd-vhosts.conf
#vim /etc/hosts 做测试,要将域名做解析**********************************
#127.0.0.1 域名 简单
cd /home/httpd
wget http://archive.apache.org/dist/apr/apr-1.4.6.tar.gz
tar -xvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install
cd /home/httpd
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
tar -xvf apr-util-1.3.12.tar.gz
cd apr-util-1.3.12
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
yum -y install gcc gcc-c++ zlib zlib-devel
cd /home/httpd
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz
tar -xvf pcre-8.32.tar.gz
cd /home/httpd/pcre-8.32
./configure --prefix=/usr/local/pcre
make && make install
cd /home/httpd
wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.29.tar.gz
tar -xvf httpd-2.4.29.tar.gz
cd /home/httpd/httpd-2.4.29
./configure --prefix=/usr/local/apache2.4 --with-arp=/usr/local/arp --with-apr-util=/usr/local/apr-util \
--with-prce=/usr/local/prce --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi \
--enable-rewrite --with-zlib --enable-modules=most --enable-mpms-shared=all
#--with-mpm=event
make && make install
#etc/httpd24/httpd.conf **********************************************
cp /usr/local/apache2.4/bin/apachectl /etc/init.d/httpd
cp /etc/httpd24/httpd.conf /etc/httpd24/httpd.conf.bak
sed -i '/#ServerName www\.example\.com\:80/a\ServerName www\.example\.com\:80' /etc/httpd24/httpd.conf
#cat /etc/init.d/httpd|grep -v ^#|grep -v ^$
#netstat -lntp|grep 80
#lsof -i :80
#/usr/local/apache2/bin/httpd –k start
#egrep -v '^[ ]*#|^$' /etc/httpd24/httpd.conf | nl
echo "/usr/local/apache2.4/bin/apachectl start">>/etc/rc.local
#apache 与 php 整合***************************************
#apache + php /etc/httpd24/httpd.conf **********
cp /etc/httpd24/httpd.conf /etc/httpd24/httpd.conf.bak
sed -i '/AddType application\/x\-gzip \.gz \.tgz$/a\ AddType application\/x\-httpd\-php\-source \.php5' /etc/httpd24/httpd.conf
sed -i '/AddType application\/x\-gzip \.gz \.tgz$/a\ AddType application\/x\-httpd\-php \.php' /etc/httpd24/httpd.conf
sed -i 's/ DirectoryIndex index\.html$/\# DirectoryIndex index\.html/g' /etc/httpd24/httpd.conf
sed -i '/^<IfModule dir\_module>$/a\ DirectoryIndex index\.html index\.php' /etc/httpd24/httpd.conf
#vim /etc/httpd24/extra/httpd-vhosts.conf 多台虚拟机****************
#sed -i '/#Include \/etc\/httpd24\/extra\/httpd-vhosts\.conf/a\Include /etc/httpd24/extra/httpd-vhosts.conf' /etc/httpd24/httpd.conf
#(
#cat << EOP
#<VirtualHost *:80>
# ServerName localhost #主机名
# DocumentRoot "/usr/local/apache2.4/htdocs" #网站位置
# ServerAdmin root@localhost #管理
# ProxyVia On
# ProxyRequests Off #关闭正向代理
# ProxyPreserveHost On #保存...
# <Proxy *>
# Require all granted #允许授权工具
# </Porxy>
## ProxyPass / http://172.0.0.1:8080/ #反向代理
## ProxyPassReverse / http://172.0.0.1:8080/
# <Location />
# Require all granted #允许授权用户访问
# </Localtion>
#</VirtualHost>
#EOP
#) >> /etc/httpd24/extra/httpd-vhosts.conf
#vim /etc/hosts 做测试,要将域名做解析**********************************
#127.0.0.1 域名 简单