zoukankan      html  css  js  c++  java
  • docker httpd 添加ssl

    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中下面的三行取消注释

    根据 https://hub.docker.com/_/httpd httpd镜像对 SSL/HTTPS 的描述:

    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

    # 添加 SSL 协议支持协议,去掉不安全的协议
    SSLProtocol all -SSLv2 -SSLv3
    # 修改加密套件如下
    SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
    SSLHonorCipherOrder on
    # 证书公钥配置
    SSLCertificateFile conf/server.crt
    # 证书私钥配置
    SSLCertificateKeyFile conf/server.key
    # 证书链配置,如果该属性开头有 '#'字符,请删除掉
    SSLCertificateChainFile conf/server-ca.crt

    step 4. 在网站根目录创建Dockefile并运行

    From httpd: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 ./conf/httpd-ssl.conf /usr/local/apache2/extra/httpd-ssl.conf CMD ["httpd-foreground"]

    将证书拷贝到项目目录
    ./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
  • 相关阅读:
    1G→2G→3G→4G→5G:一部波澜壮阔的移动通信史
    Android-X86 创始人
    如果Android 8.0的代码重新改写,那么Fuchsia OS的意义何在?
    (OK) Install php 5.6 in fedora-27
    父亲
    魏永明: MiniGUI的涅槃重生之路
    LeetCode 374. Guess Number Higher or Lower
    LeetCode 278. First Bad Version
    LeetCode 35. Search Insert Position
    查找算法-二分查找
  • 原文地址:https://www.cnblogs.com/hepeng/p/12176473.html
Copyright © 2011-2022 走看看