zoukankan      html  css  js  c++  java
  • linux ssl证书配置(apache)

    1. 前提是 已通过第三方 申请到 .crt .key 和 .ca-bundle 文件  

    2. 将三个文件拷贝到linux服务器上 任意一个指定的目录

    3. 找到要编辑的apache配置

       Apache主配置文件通常叫做 httpd.conf 或 apache2.conf. 常见路径包括 /etc/httpd/ 或 /etc/apache2/

      SSL 证书配置通常位于一个不同的配置文件的 <VirtualHost> 区块内. 配置文件可能位于诸如/etc/httpd/vhosts.d/, /etc/httpd/sites/目录, 或在一个叫做httpd-ssl.conf的文件里.

    4. 找到VirtualHost 模块进行配置

    <VirtualHost *:443>
    DocumentRoot /var/www/html2
    ServerName www.yourdomain.com
    SSLEngine on
    SLCertificateFile /path/to/your_domain_name.crt
    SSLCertificateKeyFile /path/to/your_private.key
    SSLCertificateChainFile /path/to/ComodoCA.crt
    </VirtualHost>

    5. 测试 apache config

        apachectl configtest

    6. 重启apache

       systemctl restart httpd

    顺利的情况下基本已经ok了

    但更多的时候是无法重启 遇到问题

    常见问题如下:

    1. Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration

    这个表示 ssl 需要 mod_ssl模块支持  需安装 (指令 yum install mod_ssl ,一般系统会自带openssl)

    2. 

    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.29.179.155. Set the 'ServerName' directive globally to suppress this mes sage

    这个是因为 主 apache 的 httpd.conf 配置 缺少 ServerName localhost:80, 找到 ServerName 并加上

    3. 如何兼容 http 只需要将原来的 vhost.conf 里的东西保留  同时加上ssl的文章上面所述配置内容 即可

    4. 注意 每修改一次 配置 需要重启一次 apache

     
  • 相关阅读:
    django2.2/mysql ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3
    orm练习题
    url的匹配问题
    集成抽象类后出现的问题
    迅为IMX6Q开发板上移植mplayer
    迅为i.MX6ULL开发板原理图分析介绍
    性价比高又能较好的学习嵌入式ARM+Linux的开发板
    适合初学者的linux开发板
    IMX6ULL开发板
    i.MX6ULL开发板终结者资料介绍
  • 原文地址:https://www.cnblogs.com/ISeeYouBlogs/p/apacehe_ssl.html
Copyright © 2011-2022 走看看