[root@ns1 httpd-2.4.32]# make && make install
编译如果还是报下面的错误:那就是apr和apr-util的版本有问题,centos6应该安装1.5版本的,1.6版本或者版本过低都会有问题
make[2]: * [htpasswd] 错误 1
make[2]: Leaving directory /usr/local/httpd-2.4.32/support‘<br/>make[1]: * [all-recursive] 错误 1<br/>make[1]: Leaving directory
/usr/local/httpd-2.4.32/support‘
make: * [all-recursive] 错误 1
重新安装1.5版本的在重新配置增加一个配置项
[root@ns1 httpd-2.4.32]# ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --enable-zlib --enable-modules=most --enable-mpms-shared=all --with-mpm=event --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-included-apr
如果出现下面报错:
configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
解决方案:
[root@ns1 src]# cp -fr apr-1.5.1 /usr/local/httpd-2.4.33/srclib/apr
[root@ns1 src]# cp -fr apr-util-1.5.1/ /usr/local/httpd-2.4.33/srclib/apr-util
将解压的软件包放入/usr/local/httpd-2.4.32/srclib/下(去除版本号)
报错:configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解决方案:yum install -y pcre-devel
解决了问题再重新配置
[root@ns1 httpd-2.4.32]# ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --enable-zlib --enable-modules=most --enable-mpms-shared=all --with-mpm=event --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-included-apr --enable-deflate --enable-expires
配置完成后编译、编译安装:
[root@ns1 httpd-2.4.32]# make && make install
完成后复制脚本:
[root@ns1 local]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[root@ns1 local]# /etc/init.d/httpd start
[root@ns1 local]# netstat -anpt|grep httpd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 55654/httpd
配置虚拟主机:
[root@ns1 local]# vim /etc/httpd/httpd.conf
Include /etc/httpd/extra/httpd-vhosts.conf(去掉这行的注释)
[root@ns1 local]# vim /etc/httpd/extra/httpd-vhosts.conf
<Directory "/var/www">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Require all granted
</Directory>
<VirtualHost 192.168.0.50:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/var/www"
ServerName www.benet.com
ServerAlias benet.com
ErrorLog "logs/www.benet.com-error_log"
CustomLog "logs/www.benet.com-access_log" common
</VirtualHost>
原文地址:http://blog.51cto.com/qingfeng00/2094560