CENTOS7下编译安装httpd2.4

1、yum -y install pcre-devel expat-devel openssl-devel gcc-c++ bzip2
2、tar xf apr-1.7.0.tar
3、tar xf apr-util-1.6.1.tar
4、tar xf httpd-2.4.39.tar
5、mv apr-1.7.0 httpd-2.4.39/srclib/apr
6、mv apr-util-1.6.1 httpd-2.4.39/srclib/apr-util
7、cd httpd-2.4.39/
8、./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-write --with-zlib --with-pcre --enable-mpms-shared=all --with-mpm=event
9、make && make install
10、cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
11、vim /etc/init.d/httpd
加入一行# chkconfig: 35 85 21
12、chmod+x /etc/init.d/httpd
13、chkconfig --add httpd
14、ln -sv /usr/local/apache/incule /usr/local/httpd
15、vim /etc/man_db.conf
加入一行MANDATORY_MANPATH /usr/local/apache/man
16、vim /etc/profile.d/httpd.sh
新增一行export PATH=/usr/local/apache/bin:$PATH
17、source /etc/profile.d/httpd.sh
18、vim /etc/httpd24/httpd.conf
找到#ServerName localhost:80这一行,把注释去掉
19、systemctl start httpd
20、接着打开浏览器输入你的IP地址,如果有显示It works!就证明成功了。如果浏览器无法访问,看看防火墙和SELINUX有没有关闭。

猜你喜欢

转载自blog.51cto.com/12276015/2400333