开启openssl

简介: 查看open ssl 支持生成私钥生成密钥请求文件测试用的证书配置虚拟主机中的文件1 查看open ssl 支持在网页上输出 phpinfo()<= phpinfo() >搜索OpenSSL support选项,如果为enabled,表示支持。2 生成私钥keyread为网站名称,可以按你的来写 生成需要


1 查看open ssl 支持

在网页上输出 phpinfo()

<= phpinfo() >

搜索OpenSSL support选项,如果为enabled,表示支持。

2 生成私钥

keyread为网站名称,可以按你的来写
生成需要密码的私钥,过程中会让你输入密码,用于保护

sslkey openssl genrsa -des3 -out keyread.private.pem 2048

生成不需要密码保护的私钥

sslkey openssl genrsa -out keyread.private.pem 2048

这样在目录下会有一个keyread.private.pem文件

3 生成密钥请求文件

sslkey openssl req -new -key keyread.pem -out keyread.cert.csr

在生成的过程中会让你填入国名, 城市名等信息

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]:cn
State or Province Name (full name) [Some-State]:GuangDong
Locality Name (eg, city) []:Guangzhou
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Keyread
Organizational Unit Name (eg, section) []:Keyread
Common Name (e.g. server FQDN or YOUR name) []:Keyread
Email Address []:alex_my@126.com

这样在目录下会有一个keyread.cert.csr文件,可以拿着这个文件到第三方认证机构生成最终的证书。

4 测试用的证书

自己认证自己的证书,而不是交钱给第三方。

openssl req -new -x509 -key keyread.private.pem -out keyread.debug.pem -days 365

这里用到了密钥keyread.private.pem

5 配置虚拟主机中的文件

这里使用的是nginx。

server {
    charset utf-8;
    client_max_body_size 128M;

    listen 443 ssl;
    ssl on;
    ssl_certificate /Users/alex/WWW/sslkey/keyread.debug.pem;
    ssl_certificate_key /Users/alex/WWW/sslkey/keyread.private.pem;
    server_name keyread.xyz;
    root        '/Users/alex/WWW/keyread/web/';
    index       index.php;

    access_log  /Users/alex/WWW/logs/keyread.com/access.log;
    error_log   /Users/alex/WWW/logs/keyread.com/error.log;

    location / {
        # Redirect everything that isn't a real file to index.php
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass   127.0.0.1:9000;
        try_files $uri =404;
    }

    location ~ /\.(ht|svn|git) {
        deny all;
    }
}
相关文章
|
算法 网络安全 数据安全/隐私保护
|
1月前
|
Linux Perl
源码安装openssl遇到的一些问题及解决方式
本文总结了在源码安装openssl过程中遇到的一些问题及其解决方法,包括缺少libssl.so.1.1库文件、缺少Perl模块以及权限不足时如何指定安装目录等问题。
166 0
|
12月前
|
安全 前端开发 应用服务中间件
ssl卸载原理
ssl卸载原理
290 0
|
应用服务中间件 Linux nginx
openssl版本升级后,Nginx用的还是旧版的openssl
openssl版本升级后,Nginx用的还是旧版的openssl
573 0
|
安全
升级OpenSSL
升级OpenSSL
540 0
升级OpenSSL
|
应用服务中间件 网络安全 数据安全/隐私保护
|
算法 网络协议 安全
用OpenSSL编写SSL,TLS程序
用OpenSSL编写SSL,TLS程序(1) 作者:tamsyn  来源:www.
1426 0
|
编解码 应用服务中间件 Linux
最常见的OpenSSL命令(一)
最通用的SSL工具之一是OpenSSL,它是SSL协议的开源实现。几乎每个平台都有OpenSSL版本,包括Windows,Linux和Mac OS X.OpenSSL通常用于为许多不同平台(包括Apache)创建CSR和私钥。但是,它还有数百种不同的功能,允许您查看CSR或证书的详细信息,比较证书的MD5哈希和私钥(以确保它们匹配),验证证书是否在任何网站上正确安装,并将证书转换为其他格式。可以在此处找到OpenSSL for Windows的编译版本。
477 0
|
应用服务中间件 Linux 网络安全
最常见的OpenSSL命令(二)
最通用的SSL工具之一是OpenSSL,它是SSL协议的开源实现。几乎每个平台都有OpenSSL版本,包括Windows,Linux和Mac OS X.OpenSSL通常用于为许多不同平台(包括Apache)创建CSR和私钥。但是,它还有数百种不同的功能,允许您查看CSR或证书的详细信息,比较证书的MD5哈希和私钥(以确保它们匹配),验证证书是否在任何网站上正确安装,并将证书转换为其他格式。可以在此处找到OpenSSL for Windows的编译版本。
428 0