zoukankan      html  css  js  c++  java
  • apache2 以及https证书配置

    环境Ubuntu12.04

     server 配置

      1,首先在进入找到/etc/apache2/apache2.conf的配置文件,里面有包含了较多配置文件的路径如:httpd.conf/ports.conf(端口配置)/site-enabled/等

     2,在port.conf 配置端口(http port=80, https port = 443)

       NameVirtualHost *:80

       Listen 80

          NameVirtualHost *:443

       Listen 443

       3,找到证书以key的配置路径在/etc/apache2/sites-enabled/default-ssl ,配置以下三处

      SSLCertificateFile            /etc/apache2/ssl/httpd.cert

      SSLCertificateKeyFile      /etc/apache2/ssl/httpd.key

          SSLCertificateChainFile   /etc/apache2/ssl/cacert.pem (这里cacert.pem和httpd.cert内容完全一样) 

      生成证书时,配置common name = 本机IP,否则验证时无法使用,命令如下:

      openssl req -x509 -nodes -newkey ras:2048 -keyout server.key -out server.crt -days 10950

        4,配置完成后,service apache2 restart

    client使用

      wget -ca--certificate=/certPath/cert -P /dstFilePath https://...IP../srcFile;(若通过http访问,client将不会验证证书)

      wget --no-check-certificate  -P /dstFilePath http://...IP../srcFile;

      在client 使用证书时,本机时间一定要比server生成的时间晚。否则会提示证书 not alive.

      

  • 相关阅读:
    ubuntu16.04下vim安装失败
    Sql Server函数全解(三)数据类型转换函数和文本图像函数
    Sql Server函数全解(二)数学函数
    Sql server 2008 中varbinary查询
    处理乱码问题
    快速排序
    《Java编程思想》笔记 第二章 一切都是对象
    1021: 组合数末尾的零
    11462
    The Bus Driver Problem
  • 原文地址:https://www.cnblogs.com/vincentfu/p/5721374.html
Copyright © 2011-2022 走看看