容器化的Apache服务并监控
1:基础容器编译部署apache
1.1:pull一个ubuntu 16.04的镜像
sudo docker pull ubuntu:16.04
1.2:运行容器
sudo docker run -d --name ubuntu -p 80:80 ubuntu:16.04
1.3:安装ubuntu依赖项
apt update
apt-get install vim
apt-get install net-tools
apt-get install iputils-ping
apt-get install openssh-server
apt-get install openssh-client
apt-get install lrzsz
apt-get install gcc
apt-get install libpcre3 libpcre3-dev
apt-get install make
apt-get install openssl libssl-dev
apt-get install libxml2 libxml2-dev
apt-get install zip unzip
apt-get install libexpat1-dev
apt-get install libnghttp2-dev
1.4:创建安装目录
mkdir /etc/apache2
mkdir /etc/apache2/src
cd /etc/apache2/src
1.5:下载源码并解压
如果路径失效,需要去官网下载相应的安装包
wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
wget http://apache.mirrors.lucidnetworks.net//httpd/httpd-2.4.27.tar.gz
wget http://cn2.php.net/distributions/php-7.1.8.tar.gz
tar -xvf apr-1.5.2.tar.gz
tar -xvf apr-util-1.5.4.tar.gz
tar -xvf httpd-2.4.27.tar.gz
tar -xvf php-7.1.8.tar.gz
mv -f apr-1.5.2 httpd-2.4.27/srclib/apr
mv -f apr-util-1.5.4 httpd-2.4.27/srclib/apr-util
1.6:安装依赖包zlib1g,zlib1g.dev
直接安装
sudo apt-get install libpcre3 libpcre3-dev
编译安装
在 http://jaist.dl.sourceforge.net/project/pcre/pcre/ 下载
得到文件: pcre-8.32.tar.gz
解压:tar -zxvf pcre-8.32.tar.gz
编译:
cd /home/tnuser/hunter/installers/pcre-8.32
/configure --prefix=/home/tnuser/pcre/
1.7:安装依赖包openssl和openssl-devel
直接安装
apt-get install openssl openssl-devel
下载源码编译安装
cd /etc/apache2/src
wget https://www.openssl.org/source/openssl-1.0.2h.tar.gz
tar zxf openssl-1.0.2h.tar.gz
cd openssl-1.0.2h
./config shared zlib
如果提示 because of configuration changes, you MUST do the following before*** building:
则需要在build之前做make depend
make depend
make
make install
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
echo “/usr/local/ssl/lib” >> /etc/ld.so.conf
ldconfig –v
检测安装是否成功
openssl version –a
1.8:编译apache
openssl version -a
mkdir server_root
cd src/httpd-2.4.27 ./configure --prefix=/etc/apache2/server_root --with-included-apr --with-mpm=worker --enable-so --enable-nonportable-atomics=yes --enable-ssl --enable-include --enable-cgi --enable-expires --enable-status --enable-info --enable-rewrite --enable-speling
make
make install
mkdir /etc/apache2/php7
cd /etc/apache2/src/php-7.1.8
./configure --with-apxs2=/etc/apache2/server_root/bin/apxs --prefix=/etc/apache2/php7
make
make test
make install
修改httpd.conf文件
vim /etc/apache2/server_root/conf/httpd.conf
在httpd.conf文件中添加:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
去掉httpd.conf里ServerName前面的注释:
重启apache服务
cd /etc/apache2/server_root/bin
./apachectl start
1.9:容器打包

2:配置server-status 监控apache
2.1:server-status简介
server-status是Apache查看状态的一个功能模块,在Apache 1.3.2及以后的版本提供
2.2:打开server-status
vi /etc/apache2/server_root/conf/httpd.conf
去掉LoadModule status_module modules/mod_status.so的注释

修改Include 路径 为 /etc/apache2/server_root/conf/extra/httpd-info.conf

修改配置如下
vi /etc/apache2/server_root/conf/extra/httpd-info.conf
<Location /server-status>
SetHandler server-status
Order deny,allow
Allow from all
Allow from 10.20.7.15
</Location>

去掉ExtendedStatus On 注释

vi /etc/apache2/src/httpd-2.4.33
./configure --enable-module=so --enable-info

重启apache
cd /etc/apache2/server_root/bin
./apachectl restart
3:镜像包部署apache
3.1:拉取镜像
Docker pull registry.cn-hangzhou.aliyuncs.com/zhufc/apache-status:zhu
3.2:映射80端口
docker run -d --name apache -p 80:80 registry.cn-hangzhou.aliyuncs.com/zhufc/apache-status:zhu
3.3:进入容器启动apache
docker exec -it da6a434c99e6 bash
cd /etc/apache2/server_root/bin
./apachectl start
3.4:容器后台运行
Ctrl+alt+q+p
3.4:容器后台运行
Ctrl+alt+q+p
4:页面验证apache监控
http://10.20.7.15/server-status

http://10.20.7.15/server-status/phpmyadmin

容器化的Apache服务并监控的更多相关文章
- 容器化VS微服务
1 微服务 1.1 思想 开发人员自己测试.部署和运维自己编写的代码,即自己负责构建生命周期的全部. 1.2 Spring Boot 提供服务化的能力,即把容器.服务所需依赖和服务一起打包成一个jar ...
- Docker 容器化的 SonarQube 服务在不同主机之间的迁移
安装 docker-ce // https://docs.docker.com/install/linux/docker-ce/centos/ $ sudo yum remove docker \ d ...
- network_node:host解决Docker容器化部署微服务出现的Dobbo通信问题
在Docker中,有时候出现 ports: - 20880:20880 Dobbo通信出现问题. 此时应该改成 network_node:host 注释 ports!
- 微服务SpringCloud容器化案例
前言 当我们在使用微服务的时候,那么有一个问题一定会困扰我们,那就是项目的测试和部署.因为在单体应用下,部署项目很简单,直接打包启动就可以了,而对于微服务来说,因为有各个组件的存在所以让测试和部署都变 ...
- 《容器化.NET应用架构指南》脑图学习笔记(第一部分)
一.关于这本官方“圣经” 作为.NET程序员,对于微软官方推动的架构示例总是特别关注,从PetShop到MusicStore再到eShopOnContainers,每一次关注,都会了解到业界最新的架构 ...
- 唯品会RPC服务框架与容器化演进--转
原文地址:http://mp.weixin.qq.com/s?__biz=MzAwMDU1MTE1OQ==&mid=405781868&idx=1&sn=cbb10d37e25 ...
- zabbix容器化安装及监控docker应用
一.zabbix agent2 介绍 从Zabbix 4.4之后,官方推出了Zabbix Agent 2,意味着zabbix 不在只是物理机监控的代名词,现在你可以使用Go为Zabbix编写插件,来监 ...
- jmx_prometheus_javaagent+prometheus+alertmanager+grafana完成容器化java监控告警(二)
一.拓扑图 二.收集数据 2.1前期准备 创建共享目录,即为了各节点都创建该目录,有两个文件,做数据共享 /home/target/prom-jvm-demo 1.下载文件 jmx_prometheu ...
- .NET微服务 容器化.NET应用架构指南(支持.NET Core2)
介绍 企业通过使用容器,日益实现成本节约.解决部署问题并改进 DevOps 和生产操作. 通过创建 Azure 容器服务.Azure Service Fabric 等产品,同时与 Docker.Mes ...
随机推荐
- tomcat6 高并发配置 与优化
server.xml配置 1. <Connectorport="8080"protocol="HTTP/1.1" 2. maxThreads=&quo ...
- MySQL MEB常见用法
1. 备份成镜像 备份: ./mysqlbackup --socket=/usr/local/mysql-advanced--linux-glibc2.-x86_64/data/mysql.sock ...
- go 实现struct转map
从python转golang大约一个月了,对struct的使用还算顺手,但是很多时候还是会想念python的便捷.比如同时遍历两个字典,python使用for (x, y) in zip(map1, ...
- saltstack安装部署以及简单实用
一,saltstack简介: SaltStack是一种新的基础设施管理方法开发软件,简单易部署,可伸缩的足以管理成千上万的服务器,和足够快的速度控制,与他们交流,以毫秒为单位. SaltSta ...
- BuautifulSoup4库详解
1.BeautifulSoup4库简介 What is beautifulsoup ? 答:一个可以用来从HTML 和 XML中提取数据的网页解析库,支持多种解析器(代替正则的复杂用法) 2.安装 p ...
- Ubuntu14.04 安装配置Opencv3.0和Python2.7
http://blog.csdn.NET/u010381648/article/details/49452023 Install OpenCV 3.0 and Python 2.7+ on Ubunt ...
- windows10不能修改hosts解决方案(亲测)
hosts文本解释: 有时候我们要破解一些软件与服务器通讯,所以通常都需要更改Hosts文件来达到目的,XP系统可以直接修改保存,但是Win10系统却提示没有权限去修改,那么我们要怎样办呢,我们修改的 ...
- Oracle 11g一步步安装详解
本文所需的安装包都存放在我网盘中,需要的私聊~ 一.安装VMware tools工具(非必须) 1.虚拟机上点击安装 因为我在虚拟机中做的,后面oracle 安装是图形化安装,需要屏幕大一点,不然有些 ...
- C#WebService 出现No 'Access-Control-Allow-Origin' header is present on the requested resource
C#WebService 出现No 'Access-Control-Allow-Origin' header is present on the requested resource 解决办法: 在c ...
- Create R NoteBook require updated versions of the following packages : knitr,rmarkdown.
Create R NoteBook require updated versions of the following packages : knitr,rmarkdown. 点击yes安装失败的时 ...