Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker deploys Apache services and monitors

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

1: the basic container compiles and deploys a ubuntu 16.04image of apache1.1:pull

Sudo docker pull ubuntu:16.04

1.2: run the container

Sudo docker run-d-name ubuntu-p 80:80 ubuntu:16.04

1.3Install ubuntu dependencies

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: create the installation directory

Mkdir / etc/apache2

Mkdir / etc/apache2/src

Cd / etc/apache2/src

1.5: download the source code and decompress it

If the path fails, you need to go to the official website to download the corresponding installation package

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: install the dependency package zlib1g,zlib1g.dev

Direct installation

Sudo apt-get install libpcre3 libpcre3-dev

Compilation and installation

Download from http://jaist.dl.sourceforge.net/project/pcre/pcre/

Get the file: pcre-8.32.tar.gz

Decompress: tar-zxvf pcre-8.32.tar.gz

Compile:

Cd / home/tnuser/hunter/installers/pcre-8.32

/ configure-- prefix=/home/tnuser/pcre/

1.7: install dependency packages openssl and openssl-devel

Direct installation

Apt-get install openssl openssl-devel

Download source code compilation and installation

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

If prompted by because of configuration changes, you MUST do the following before*** building:

You need to do make depend before build.

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

Check whether the installation is successful

Openssl version-a

1.8Compiled 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

Modify the httpd.conf file

Vim / etc/apache2/server_root/conf/httpd.conf

Add to the httpd.conf file:

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

Remove the comments in front of ServerName in httpd.conf:

Restart the apache service

Cd / etc/apache2/server_root/bin

. / apachectl start

1.9: container packing

2: an introduction to configuring server-status Monitoring apache2.1:server-status

Server-status is a functional module for Apache to view status, which is available in Apache 1.3.2 and later

2.2: open server-status

Vi / etc/apache2/server_root/conf/httpd.conf

Remove the comments from LoadModule status_module modules/mod_status.so

Change the Include path to / etc/apache2/server_root/conf/extra/httpd-info.conf

Modify the configuration as follows

Vi / etc/apache2/server_root/conf/extra/httpd-info.conf

SetHandler server-status

Order deny,allow

Allow from all

Allow from 10.20.7.15

Remove ExtendedStatus On comments

Vi / etc/apache2/src/httpd-2.4.33

. / configure-enable-module=so-enable-info

Restart apache

Cd / etc/apache2/server_root/bin

. / apachectl restart

3: image package deployment apache3.1: pull image

Docker pull registry.cn-hangzhou.aliyuncs.com/zhufc/apache-status:zhu

3.2: map port 80

Docker run-d-name apache- p 80:80 registry.cn-hangzhou.aliyuncs.com/zhufc/apache-status:zhu

3.3: enter the container to start apache

Docker exec-it da6a434c99e6 bash

Cd / etc/apache2/server_root/bin

. / apachectl start

3.4: container runs in the background

Ctrl+alt+q+p

3.4: container runs in the background

Ctrl+alt+q+p

4: page verification apache monitoring

Http://10.20.7.15/server-status

Http://10.20.7.15/server-status/phpmyadmin

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report