Fedora 12安装之后,默认就有了httpd,如果没有,需要到http://httpd.apache.org/手动下载,编译。
为了本次演示,我专门卸载了原有的httpd,重新下载并安装apache。卸载方法:yum -e httpd.
1:到apache官方网站 http://httpd.apache.org/download.cgi 下载最新版本的apache,然后解压,执行如下命令:
./configure –prefix=/root/soft/apache
configure: error: APR not found. Please read the documentation.
2:提示缺少apr,下载http://apache.freelamp.com/apr/ ,编译安装完成apr之后,继续编译apache.
3:编译( ./configure –prefix=/root/soft/apr-util –with-apr=/root/soft/apr)
configure: error: APR-util not found. Please read the documentation
4:缺少apr-util,下载编译apr-util之后,继续编译apache
/configure –prefix=/root/soft/apache –with-apr=/root/soft/apr/ –with-apr-util=/root/soft/apr-util/
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
5:再次提示缺少pcre,下载之http://sourceforge.net/projects/pcre/ 编译 安装(我这里均安装在/root/soft目录里,例如./configure –prefix=/root/soft/pcre)
./configure –prefix=/root/soft/apache –with-apr=/root/soft/apr/ –with-apr-util=/root/soft/apr-util/ –with-pcre=/root/soft/pcre
6:然后就可以编译通过了。
7:照例make ,make install,然后到/root/soft/apache/bin目录里,执 行./apachectl start,启动httpd服务,在浏览器中输入127.0.0.1进行测试,可 以出来网页,但是提示403 Forbidden,因为我的www目录默认在/root/soft/apache/htdocs目录,该目录是root权限的目录,web用户是无权限访问的,修改apache/conf/httpd.conf。把DocumentRoot 修改为 /var/www/html (可以在var下面新建这些目录) ,同时还需要修改至,保存,执行apachectl restart,即可
8:apache在linux默认是支持ipv4/ipv6的,在浏览器中输入[::1],期待已久的网页出现啦…
Enjoy It!
附:
1:在configure的时候,如果遇到缺少其他软件,可以先看一下help,例如本次安装过程中如果提示缺少apr,那么
./configure –help|grep apr
2:我的apache的编译命令:
./configure –prefix=/root/soft/apache –withpr=/root/soft/apr –with-apr-util=/root/soft/apr-util/ –with-pcre=/root/soft/pcre/ –enable-so