Centos Apache安装

2/10/2017来源:ASP.NET技巧人气:1089

Apache安装:下载地址:http://httpd.apache.org/download.cgi

apache需要先安装依赖包aPR、apr-util、pcre

apr、apr-util下载地址:https://apr.apache.org/download.cgi

pcre下载地址:http://blog.csdn.net/wangjunjun2008/article/details/38314387

tar -zxvf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make && make install


tar -zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config 
make && make install


tar-zxvf pcre-8.40.tar.gz
cd pcre-8.40
./configure --prefix=/usr/local/pcre
make && make install

 完成依赖包安装后,安装apache:

tar-zxvf httpd-2.4.10.tar.gz
cd httpd-2.4.10
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/  --with-pcre=/usr/local/pcre/
make && make install

 安装完成后

./usr/local/apache/bin/httpd -k start

Usage: ./httpd [-D name] [-d directory] [-f file]                [-C "directive"] [-c "directive"]                [-k start|restart|graceful|graceful-stop|stop]                [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X] 

访问机器所在ip,出现It works的界面,即表示Apache安装成功

httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName 的原因参考下面链接的解答:

http://stackoverflow.com/questions/5856205/starting-httpd-httpd-could-not-reliably-determine-the-servers-fully-qualified