Note how to create a self-signed certificate with Docker Apache
See article below [Linux] Docker environment construction on Redhat
version: '3'
services:
apache:
build: apache
container_name: apache
ports:
- 80:80
volumes:
- ./apache/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf
apache
FROM httpd:latest
RUN apt update \
&& apt install -y \
git \
gcc \
make \
build-essential \
wget \
curl \
llvm \
xz-utils \
tk-dev \
zlib1g-dev \
libncurses5-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
libxmlsec1-dev \
liblzma-dev \
libpq-dev \
libffi-dev
WORKDIR /usr/local/apache2
docker-compose up -d apache
Enter the apache container and create a self-signed certificate See the article below for details [Apache] Create self-signed certificate
-Add the created self-signed certificate to volumes ・ Added "443" to ports
version: '3'
services:
apache:
build: apache
container_name: apache
ports:
- 80:80
- 443:443 <==add to
volumes:
- ./apache/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf
- ./apache/conf/server.crt:/usr/local/apache2/conf/server.crt <==add to
- ./apache/conf/server.key:/usr/local/apache2/conf/server.key <==add to
./apache/conf/httpd.conf
・ ・ ・
LoadModule ssl_module modules/mod_ssl.so <==add to
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so <==add to
・ ・ ・
↓↓↓↓↓↓↓↓↓↓ Added ↓↓↓↓↓↓↓↓↓↓
Include conf/extra/httpd-ssl.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
↑↑↑↑↑↑↑↑↑↑ Added ↑↑↑↑↑↑↑↑↑↑
docker-compose up -d apache
OK if HTTPS connection is possible https://localhost
Recommended Posts