step 1. 将httpd容器中/usr/local/apache2/conf/httpd.conf和
/usr/local/apache2/conf/extra/httpd-ssl.conf 拷贝出来用于修改
docker cp命令:
step 2. 将/usr/local/apache2/conf/httpd.conf中下面的三行取消注释
The https://hub.docker.com/_/httpd the httpd mirrored SSL / HTTPS described:
removing the comment symbol from the following lines:
... #LoadModule socache_shmcb_module modules/mod_socache_shmcb.so ... #LoadModule ssl_module modules/mod_ssl.so ... #Include conf/extra/httpd-ssl.conf ...
step 3. 配置/usr/local/apache2/conf/extra/httpd-ssl.conf
# Add SSL protocol support agreement, remove insecure protocol
SSLProtocol All -SSLv2 -SSLv3
# modify the cipher suite follows
SSLCipherSuite HIGH:! RC4:! MD5 :! ANULL:! ENULL:! NULL:! DH:! EDH:! EXP: MEDIUM, +
SSLHonorCipherOrder ON
# configure the public key certificate
SSLCertificateFile conf / server.crt
# configure certificate private key
SSLCertificateKeyFile conf / server.key
# certificate chain configuration, if the property has a beginning '#' character, please delete
SSLCertificateChainFile conf / server-ca .crt
step 4. 在网站根目录创建Dockefile并运行
Httpd the From: Latest COPY / usr / local / apache2 / htdocs /. COPY ./cert/server.crt /usr/local/apache2/conf/server.crt COPY ./cert/server.key / usr / local / apache2 / conf / server.key COPY ./cert/server-ca.crt /usr/local/apache2/server-ca.crt COPY ./conf/httpd.conf /usr/local/apache2/conf/httpd.conf COPY ./ the conf / /usr/local/apache2/extra/httpd-ssl.conf the httpd-the ssl.conf the CMD [ "the httpd-foreground"]
will be copied to the program certificate directory ./cert/server.crt ./cert/server.key. /cert/server-ca.crt
docker build -t mydockerimage .
docker run -it -d -p 80:80 -p 443:443 mydockerimage