zoukankan      html  css  js  c++  java
  • How To Create a SSL Certificate on Apache for CentOS 6

    About Self-Signed Certificates

    自签证书。一个SSL证书,是加密网站的信息,并创建更安全的链接的一种方式。附加地,证书可以给网站浏览者显示VPS的的身份证明信息。如果一个SSC没有第三方证实,那么证书作者可以发行SSL证书,用以验证虚拟服务器的细节。

    Step One-Install Mod SSL

    为了设置自签名证书,我们先要确保Apache和Mod SSL已经在VPS上安装。你可以通过下面的命令安装他们:

    yum install mod_ssl

    Step Two-Create a New Directory

    下一步,我们需要创建一个新的路径,用以存储server key和certificate.

    mkdir /etc/httpd/ssl

    Step Three-Create a Self Signed Certificate

    当我们请求一个新证书,我们可以通过改变365为任何我们乐意的数字,来指定证书的有效期。

    标准的证书,会在一年后过期。

    openssl req -x509 -nodes -days 365 -newkey rsa:2048 
    -keyout /etc/httpd/ssl/apache.key 
    -out /etc/httpd/ssl/apache.crt

    通过该命令,我们重建了自签名SSL certificate,和保护它的server key,并把他们都放在该新路径里。

    该命令会要求输入一些信息。

    最重要的是Common Name这一行,在这儿填入你的官方域名。如果你还没有,你可以写网站的IP地址。

    You are about to be asked to enter information that will be 
    incorporated into your certificate request.
    What you are about to enter is what is called a Distinguished 
    Name or a DN.
    There are quite a few fields but you can leave some blank
    For some fields there will be a default value,
    If you enter '.', the field will be left blank.
    -----
    Country Name (2 letter code) [AU]:US
    State or Province Name (full name) [Some-State]:New York
    Locality Name (eg, city) []:NYC
    Organization Name (eg, company) [Internet Widgits Pty Ltd]:Awesome Inc
    Organizational Unit Name (eg, section) []:Dept of Merriment
    Common Name (e.g. server FQDN or YOUR name) []:example.com                  
    Email Address []:webmaster@awesomeinc.com

    Step Four-Set Up the Certificate

    现在,所有必要的部分已经完成。下一步,要设置虚拟主机,来显示新的certificate.

    打开SSL config 文件

    vi /etc/httpd/conf.d/ssl.conf

    找到<VirtualHost _default_443>,做一些快速改变。

    取消DocumentRoot和ServerName行的备注,用你DNS可以抵达的域名或服务器IP地址,替换example.com。(它应该和certificate上的common name一样):

    ServerName example.com:443

    找到下面的三行,确保他们和下面的表达式匹配:

    SSLEngine on
    SSLCertificateFile /etc/httpd/ssl/apache.crt
    SSLCertificateKeyFile /etc/httpd/ssl/apache.key

    你的虚拟主机现在全都设置好了。保存并退出文件。

    Step Five-Restart Apache

    你已经做完。重启Apache server,会重载你修改过配置。

    /etc/init.d/httpd restart
    在你的浏览器,键入https://youraddress,会显示该新certificate。

     

     

     

  • 相关阅读:
    Teamviewer12完美破解版去除时间限制完美使用
    winFrom程序更新自动安装
    sql 根据指定字符截取前面几个字符
    下拉框带搜索
    easyui 展开缩起
    p1001 谁拿了最多的奖学金
    p1217 乒乓球
    p1911 珠心算问题
    p1848 记数问题
    入坑archlinux
  • 原文地址:https://www.cnblogs.com/msdynax/p/3735090.html
Copyright © 2011-2022 走看看