1、安装依赖包 
 
tar zxvf apr-1.5.0.tar.gz 
tar zxvf apr-util-1.5.3.tar.gz
cd apr-1.5.0
./configure --prefix=/usr/local/apr 
make 
make install
cd apr-util-1.5.3
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr 
make 
make install
2、安装httpd 
 
yum install -y gcc gcc-c++  #如果没有装c++ 
tar zxvf pcre-8.33.tar.gz 
tar zxvf httpd-2.4.7.tar.gz
cd pcre-8.33
./configure --prefix=/usr/local/pcre 
make 
make install
cd httpd-2.4.7
./configure --prefix=/usr/local/apache --enable-so --enable-dav --enable-dav-fs --enable-mnaintainet-mode --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre 
make 
make install
3、换端口 
vi /usr/local/apache/conf/httpd.conf 
将80端口换成81端口 
 
出现httpd: Could not reliably determine the server's fully qualified domain name, using localhost.local
解决方法:
vim /usr/local/apache/conf/httpd.conf 
 
修改为:
 
停止apache服务器: