zoukankan      html  css  js  c++  java
  • Ubuntu 14 中给 APACHE2安装 SSL 模块

    Ubuntu 14 中给 APACHE2安装 SSL 模块

     Enable SSL site on Ubuntu 14 LTS, Apache 2.4.7:

    参考 http://blog.csdn.net/Sky_qing/article/details/44303221


    1. 启用SSL模块
    sudo a2enmod ssl

    如果不执行这条命令, apache2ctl configtest 检测会有这样的错误


     
    1. AH00526: Syntax error on line 43 of /etc/apache2/mods-enabled/ssl.conf:  
    2. SSLSessionCache: 'shmcb' session cache not supported (known names: ). Maybe you need to load the appropriate socache module (mod_socache_shmcb?).  
    3. Action 'configtest' failed.  
    4. The Apache error log may have more information.  


    2. 给SSL模块作个连接


     
    1. ln -s /etc/apache2/mods-available/ssl.load /etc/apache2/mods-enabled/ssl.load  
    2. ln -s /etc/apache2/mods-available/ssl.conf /etc/apache2/mods-enabled/ssl.conf  


    3. 制作数字证书
    先生产请求文件 ,也可以在线生成。然后在一些证书颁发网站用这个csr文件 申请证书,比如 comodo
    openssl req -new -newkey rsa:2048 -nodes -keyout comodo.key -out comodo.csr
    https://www.freehao123.com/comodo-positivessl/

    4. 把做好的证书复制到相应目录

     
    1. cp server.crt /etc/ssl/certs    
    2. cp server.key /etc/ssl/private    


    5. 修改配置文件并作个链接

     
    1. cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-ssl-default.conf  
    2.   
    3. ln -s /etc/apache2/sites-available/000-ssl-default.conf /etc/apache2/sites-enabled/001-ssl-default.conf  
    4. vim 001-ssl-default.conf  


    在<VirtualHost *:80>段中,DocumentRoot一行的下方加入内容:

     
    1. SSLEngine On    
    2. SSLOptions +StrictRequire    
    3. SSLCertificateFile /etc/ssl/certs/server.crt    
    4. SSLCertificateKeyFile /etc/ssl/private/server.key    


    <VirtualHost *:80> 中的80改为443 <VirtualHost *:443>(ssl的端口)

    6. 在重启服务前先检查下语法:
    apache2ctl configtest

    7. 没有错误的话,重启Apache也是很有技巧的:)

     
    1. cd /etc/apache2/sites-enabled  
    2. a2enmod ssl  
    3. a2ensite 001-ssl-default  
    4. service apache2 reload  
    5. service apache2 restart  


    如果更改了 APACHE2 的模块,在重启服务器之前,这个 service apache2 reload  指令或不可少,对 添加了 SSL 模块而言,缺少这条指令,HTTPS:// 会有如下错误

     
      1. chrome浏览器:   ERR_SSL_PROTOCOL_ERROR  
      2.   
      3. firefox浏览器:  SSL 接收到一个超出最大准许长度的记录。 错误代码: SSL_ERROR_RX_RECORD_TOO_LONG  
      4.   
      5. IE 浏览器:      确保启用了 TLS 和 SSL 协议。转到“工具”>“Internet 选项”>“高级”>“设置”>“安全”  
      6.   
      7. Openssl/ Wget : error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol  

    无法找到php包时

    $ apt install -y software-properties-common

    $ add-apt-repository ppa:ondrej/php

    $ sudo apt-get update //更新包管理

  • 相关阅读:
    淘宝技术这十年(淘宝技术大学校长解密淘宝十年)
    Go Web编程(Go语言性能好、语法简单、开发效率高!)
    辨别虚假流量的十二种方法
    收获,不止Oracle(顶级专家盖国强、冯春培、黄志洪等联袂力荐)
    演说之禅:职场必知的幻灯片秘技(第2版)(全彩)
    篮球词汇(转)
    Xilinx 网站资源导读
    乔布斯2005年在斯坦福毕业典礼的演讲稿
    FPGA中BRAM初始化文件格式的总结_ALTERA/XILINX
    写给还在上班的人(转)
  • 原文地址:https://www.cnblogs.com/lijurui/p/9216327.html
Copyright © 2011-2022 走看看