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
  • 相关阅读:
    windows的一组常用运行命令
    nfs:server is not responding,still trying 原因与解决方案
    MYSQL外键(Foreign Key)的使用
    byte[]转字符串编码问题
    /usr/bin/ld: cannot find lGL
    Linux查看用户及分组
    NAND和NOR flash的区别
    Win7+Ubuntu11.10(EasyBCD硬盘安装)
    Win7+Ubuntu12.04.1硬盘安装错误及解决方案
    Linux内核编译时错误
  • 原文地址:https://www.cnblogs.com/hepeng/p/12176473.html
Copyright © 2011-2022 走看看