简介:实战演练apache网站服务器的搭建
Apache简介:
Apache软件基金会的一个开源免费的网页服务器,也是目前世界上使用最广泛的一种web server ,
apache最出名的是它跨平台,高效和稳定,可以运行在几乎所有广泛使用的计算机平台上。
其特点是简单、速度快、性能稳定,并可做代理服务器来使用,并且可通过简单的 API 扩充,将 Perl/Python 等解释器编译到服务器中。
 
源码编译安装 Apache:
 
下载组件apr并解压:
组件apr官方网站:http://apr.apache.org/download.cgi
wget http://mirror.bit.edu.cn/apache//apr/apr-1.7.0.tar.gz
tar -xf apr-1.7.0.tar.gz
 
下载组件apr-util并解压:
组件apr-util官方网站:http://apr.apache.org/download.cgi
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar -xf apr-util-1.6.1.tar.gz
 
下载apache并解压:
apache官方网站:http://httpd.apache.org/download.cgi
wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.39.tar.gz
tar -xf httpd-2.4.39.tar.gz
 
安装gcc环境:
yum install -y gcc*
 
安装zlib-devel库:
yum install -y zlib-devel
 
安装xml 的解析器:
yum install -y expat-devel
 
下载并安装pcre正则表达式库:
下载地址:https://ftp.pcre.org/pub/pcre/
tar -xf pcre-8.43.tar.gz
cd pcre-8.43
mkdir -p /usr/local/pcre
./configure --prefix=/usr/local/pcre
make && make install
 
把组件apr与组件apr-util拷贝到apache安装包里:
cp -rf apr-1.7.0 /root/test/httpd-2.4.39/srclib/apr
cp -rf apr-util-1.6.1 /root/test/httpd-2.4.39/srclib/apr-util
 
进入apache解压包进行./configure进行环境收集检验与配置相关模块:
cd /root/test/httpd-2.4.39
mkdir -p /usr/local/apache
 
 
./configure \--prefix=/usr/local/apache \--sysconfdir=/usr/local/apache/etc \--with-apr=/root/test/apr-1.7.0
\--with-apr-util=/root/test/apr-util-1.6.1 \--with-included-apr \--with-pcre=/usr/local/pcre \--enable-deflate
\--enable-expires \--enable-headers \--enable-so \--enable-modules=most \--with-mpm=worker \--enable-rewrite
 
选项说明:
--prefix #指定安装目录
--sysconfdir #指定配置文件的路径--with-apr #指定依赖文件的路径
--with-apr-util #指定依赖文件的路径
--with-included-apr #增加编译效率的
--with-pcre #指定pcre正则表达式库安装路径
--enable-deflate #开启压缩文件提高速度节约带宽
--enable-expires #开启让浏览器缓存,减轻服务器压力,提高访问速度
--enable-headers #使得支持http头
--enable-so #使得支持动态模块
--enable-modules=most #使得支持大多数模块
--with-mpm=worker #使得Apache工作在worker模式下
--enable-rewrite #使得支持地址重写
 
编译并安装apache:
make -j 4 && make install
 
设置服务器名称:
vi /usr/local/apache/etc/httpd.conf
输入:ServerName进行搜索
添加:ServerName www.xdclss.com
 
测试并启停apache服务器:
ln -s   /usr/local/apache/bin/*   /usr/sbin/ #设置软连接
echo "export PATH=/usr/local/apache/bin:$PATH" >> /etc/profile #设置环境变量
source /etc/profile #加载环境变量
httpd -t #测试配置文件语法有没有错误
httpd -k start #启动apache服务
httpd -k stop #关闭apache服务
在防火墙关闭的条件下,打开浏览器,输入IP地址,成功打开apache测试页面
 
相关报错收集与解决办法:
(1)make[1]: *** [xml/apr_xml.lo] Error 1
make[1]: Entering directory `/home/test/apr-util-1.6.1'
/bin/sh /usr/local/apache/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -
pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/home/test/apr-
util-1.6.1/include -I/home/test/apr-util-1.6.1/include/private -
I/usr/local/apache/apr/include/apr-1 -o xml/apr_xml.lo -c xml/apr_xml.c &&
touch xml/apr_xml.lo
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
# include <expat.h> ^
compilation terminated.
make[1]: *** [xml/apr_xml.lo] Error 1
make[1]: Leaving directory `/home/test/apr-util-1.6.1'
make: *** [all-recursive] Error 1
错误原因:缺少xml 的解析器
解决方法:yum -y install expat-devel
(2)configure 时 error: APR not found
错误详情:
configure:
checking for APR… no
configure: error: APR not found. Please read the documentation.
错误原因:没有指定 Apache 必需组件 APR 或没有加–with-apr 选项指定 APR
的安装位置。
解决方法:安装 APR 并且加-–with-apr 选项指定正确的位置。
(3)configure 时-–with-apr 选项不正确
错误详情:
configure:
checking for APR… configure: error: –with-apr requires a directory
or file to be provided
configure:
checking for APR… configure: error: the –with-apr parameter is
incorrect. It must specify an install prefix, a build directory, or
an apr-config file.
错误原因:-–with-apr 选项不能为空或者指定的 APR 的位置不正确
解决方法:指定正确的 APR 选项。其实系统中已经使用 yum 安装了 APR,却不
知道如何指定 yum 安装的 APR 的位置,故出此错误,也可以进行手动源代码编译安装
APR来解决这个错误。
(4)configure 时 error: APR-util not found
错误详情:
configure:
checking for APR-util… no
configure: error: APR-util not found. Please read the documentation.
错误原因:没有安装 Apache 必需组件 APR-util 或没有加–with-apr-util 选
项指定 APR-util 的位置
解决方法:-–with-apr-util 选项指定正确的安装位置
(5)configure 时 error: pcre-config for libpcre not found
错误详情:
checking for pcre-config… false
configure: error: pcre-config for libpcre not found. PCRE is required
and available from http://pcre.org/
错误原因:没有安装 Apache 必需组件 PCRE 或没有加–with-pcre 选项指定
PCRE 的安装位置。
解决方法:安装 PCRE 并且加–with-pcre 选项指定正确的安装位置
(6)configure 时 error: Did not find pcre-config script at
/usr/local/pcre2
错误详情:
checking for pcre-config… false
configure: error: Did not find pcre-config script at /usr/local/pcre2
错误原因: httpd 2.4.39 不支持 pcre2?
解决方法:下载 pcre-8.43 安装即可。
(7)启动 Apache 时提示设置 ServerName
错误详情:
AH00558: httpd: Could not reliably determine the server's fully qualified domain
name, using localhost.localdomain. Set the 'ServerName' directive globally to
suppress this message
错误原因:没有设置服务器名称
解决方法:vi /usr/local/apache/etc/httpd.conf
 
 
 
 
 
 
 
 
 
 
 
 
 

CentOS7 实战源码部署apache网站服务器的更多相关文章

  1. CentOS7 实战源码部署nginx网站服务器

    简介:实战演练nginx网站服务器的搭建 nginx 简介: Nginx是一款高性能的 HTTP 和反向代理服务器   Nginx的优点: 1.高并发量:根据官方给出的数据,能够支持高达 50,000 ...

  2. CentOS7 实战源码部署php服务与nginx 的整合

    简介:实战演练php服务的搭建 PHP是一种脚本语言,常用于做动态网站的. 源码编译安装: 安装依赖组件: yum -y install gcc gcc-c++ bzip2 bzip2-devel b ...

  3. CentOS7 实战源码安装mysql5.7.17数据库服务器

    CentOS7 实战源码安装mysql5.7.17数据库服务器 简介:实战演练mysql数据库服务器的搭建  mysql简介: mysql是一个开源的关系型数据库管理系统,现在是oracle公司旗下的 ...

  4. Centos7源码部署apache/httpd服务

    httpd:是一个提供网站服务的程序 监听端口:80 环境准备: Linux CentOS7.3系统 使用一台服务端,一台客户端即可: 一.安装httpd 1:安装 [root@localhost ~ ...

  5. Centos7源码安装Apache和PHP

    源码安装Apache 安装需要的依赖 yum -y install gcc autoconf automake make pcre pcre-devel openssl openssl-devel​# ...

  6. centos7源码安装Apache及Tomcat

    源码安装Apache (1) 一.通过 https://apr.apache.org/  下载 APR 和 APR-util 通过 http://httpd.apache.org/download.c ...

  7. linux下源码安装apache服务

    1.搭建静态网站是,我们只需要搭建apache服务即可满足要求. 例如:如果我再客户端游览器输入地址,他会找到192.168.1.100这个服务器,然后根据端口会找到apache服务器.apache他 ...

  8. Linux学习日记——源码编译Apache

    [本文为笔者在学习Linux 下的软件安装时,尝试使用源码安装Apache 的过程,事后进行一个小小的总结,发现错误望指正.] 一.典型的源码编译安装软件的过程包括以下3步: 1) 运行 config ...

  9. 烂泥:源码安装apache

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 最近要开始学习nagios监控方面的知识了,但是nagios与apache结合的比较紧密,所以本篇文章就先把apache的源码安装学习下. 我们现在分以 ...

随机推荐

  1. lambda表达式中无法抛出受检异常!

    抛出受检异常的时候,我们的接口应该带上throw关键字,但通过lambda表达式实现的Consumer的accept方法并不带有关键字,因此在lambda表达式中不能抛出受检异常必须把它吃掉

  2. Kafka入门之consumer

    offset存放在_consumer_offsets这个topic下 并且从0-49划分了50个分区: consumer会在kafka集群的所有broker中选择一个broker作为consumer ...

  3. Linux下使用Docker部署nacos-server(单机模式),丧心病狂的我在半夜给UCloud提交了一份工单

    1. 拉取nacos-server镜像 进入 Docker Hub 查看nacos-server最新版本为 nacos-server:1.4.0 配置阿里云镜像加速 sudo mkdir -p /et ...

  4. C和指针课后练习题4

    1.下面表达式是否合法?如果合法,他执行什么任务? 3* x * x - 4 * x + 6; 合法;他只是执行了表达式求值,但是他的结果并不存于任何地方. 2.赋值语句的语法? 数据类型 变量名 = ...

  5. JZOJ8月15日提高组反思——2020年暑假终结篇

    JZOJ8月15日提高组反思--2020年暑假终结篇 T1 仙人掌最短路 抱歉我只会最短路 仙人掌是啥? 听说是缩点+\(LCA\) 最短路30 T2 直接暴力计算 正解\(DP\) \(amazin ...

  6. 「懒惰的美德」我用 python 写了个自动生成给文档生成索引的脚本

    我用 python 写了一个自动生成索引的脚本 简介:为了刷算法题,建了一个 GitHub仓库:PiperLiu / ACMOI_Journey,记录自己的刷题轨迹,并总结一下方法.心得.想到一个需求 ...

  7. PyQt(Python+Qt)学习随笔:树型部件QTreeWidget中使用sortItems进行项排序

    老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 树型部件QTreeWidget中的项可以使用sortItems方法按照指定列进行排序,调用语法: s ...

  8. PyQt(Python+Qt)学习随笔:QListWidget删除项的takeItem方法

    老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 takeItem方法从QListWidget列表部件的项中删除指定项,并返回对应项对象.调用语法如下 ...

  9. WebRequest抓取网页数据出现乱码问题

    今天项目里突然有个功能用不起来了,本机确实好的 ,这个很无语 不知道为啥 经过写日志发现html 变成了这样的东西,很是头疼,刚开始各种编码转换,发现这并不是编码的问题 后面观察目标网站多了一个gzi ...

  10. 查询满足条件的最新数据(逐步优化,mysql、达梦数据库)

    1.条件:报警信息表sensor_warning 2.需求: 查询当前车厢的.不同设备的.所有处理未完成的.不同报警原因的.时间最新的数据集合,最后按设备id或报警时间排序 3.原始sql,不满足实际 ...