Centos下怎么搭建Apache环境

发布时间:2022-02-17 09:49:17 作者:iii
来源:亿速云 阅读:109

今天小编给大家分享一下Centos下怎么搭建Apache环境的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。

Apache是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一。它快速、可靠并且可通过简单的API扩充,将Perl/Python等解释器编译到服务器中。

Centos下怎么搭建Apache环境

一、安装

安装之前先将服务器的防火墙关掉。

systemctl stop firewalld

systemctl disable firewall

第一步:

安装apr

下载:

wget -c http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.bz2

解压该文件:

tar -jvxf apr-1.6.3.tar.bz2

检测:

cd apr-1.6.3
./configure --prefix=/usr/local/apr/

编译:

make
make install

第二步:

安装apr-util

下载:

wget -c http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.bz2

解压该文件:

tar -jvxf apr-util-1.6.1.tar.bz2

检测:

cd apr-util-1.6.3
./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/

编译:

makemake install

第三步:

安装pcre

下载:

wget -c http://ftp.pcre.org/pub/pcre/pcre-8.42.tar.bz2

解压该文件:

tar -jvxf pcre-8.42.tar.bz2

检测:

cd pcre-8.42./configure --prefix=/usr/local/pcre/

编译:

makemake install

第四步: 安装httpd

下载:

wget -c http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.bz2

解压该文件:

tar -jvxf httpd-2.4.29.tar.bz2

检测:

cd httpd-2.4.29./configure --prefix=/usr/local/httpd/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/

编译:

makemake install

第五步:

配置/usr/local/apache2/conf/httpd.confServerName www.examda.com:80改为ServerName localhost:80

第六步:

启动apache服务

/usr/local/apache2/bin/apachectl start

二、检测

使用浏览器访问本地IP

出现It works!成功

三、报错处理

(1)configure: error: APR not found. Please read the documentation.

这是没有安装apr或者apr安装失败导致的,重新安装apr。

安装请查看第一步。

(2)configure: error: APR-util not found. Please read the documentation.

这是没有安装apr-util或者apr-util安装失败导致的,重新安装apr-util。

安装请查看第二步。

(3)configure: error: no acceptable C compiler found in $PATH

这是没有安装gcc编译器或者gcc编译器安装失败导致的,重新安装gcc。

yum install -y gcc

(4)xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录

这是没有安装expat-devel或者expat-devel安装失败导致的,重新安装expat-devel。

yum install -y expat-devel

(5)configure: error: Invalid C++ compiler or C++ compiler flags

这是没有安装gcc-c++或者gcc-c++安装失败导致的,重新安装gcc-c++。

yum install -y gcc-c++

(6)configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

这是没有安装pcre或者pcre安装失败导致的,重新安装pcre。

安装请查看第三步。

以上就是“Centos下怎么搭建Apache环境”这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注亿速云行业资讯频道。

推荐阅读:
  1. Windows下Apache和php环境怎么搭建
  2. 搭建centos7+apache+mongodb+php环境

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

apache centos

上一篇:Linux下如何安装Postfix邮件虚拟用户及虚拟域

下一篇:Linux下如何安装并使用Terminalizer

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》