【问题标题】:How to generate CSR for SSL that works with Nginx & Apache?如何生成适用于 Nginx 和 Apache 的 SSL 的 CSR?
【发布时间】:2012-10-24 15:58:53
【问题描述】:

我想生成用于请求 SSL(通配符)证书的 CSR 文件。此证书和私钥将在多台同时使用 Apache 和 Nginx 的机器上使用。

RapitSSL 为不同的设置声明了以下命令:

  • Nginx

    $ openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr

  • Apache Mod SSL

    $ openssl genrsa -des3 -out <private key file name>.key 2048

  • Apache-SSL

    $ openssl genrsa -des3 -out www.yourdomain-example.com.key 2048

有没有办法生成适用于 Apache 和 Nginx 的 CSR?

【问题讨论】:

  • 投票迁移到 ServerFault,这里是题外话。
  • 感谢您澄清这一点。请移至相应的论坛。

标签: apache ssl https nginx openssl


【解决方案1】:

如何生成适用于 Nginx 和 Apache 的 SSL 的 CSR ...
有没有办法生成适用于 Apache 和 Nginx 的 CSR?

快速回答问题以澄清事情... Nginx 和 Apache 不使用 CSR。他们使用证书和私钥。

也许您的意思是关于自签名证书?如果是这样,请将-x509 选项添加到openssl req 命令。这会创建自签名证书而不是签名请求。

自签名证书(以及一般的服务器证书)还有很多内容。例如,请参阅How to create a self-signed certificate with openssl?

【讨论】:

    【解决方案2】:
    • Apache Mod SSL

      $ openssl genrsa -des3 -out .key 2048

    • Apache-SSL

      $ openssl genrsa -des3 -out www.yourdomain-example.com.key 2048

    这两个显然是完全相同的命令,只是示例名称的写法不同。他们只是生成密钥对,您还需要一个额外的req 命令来生成 CSR。

    genrsa 生成密钥对,req 生成 CSR。但是,req 在使用-newkey 时可以同时执行这两个操作。

    OpenSSL req example documentation:

    创建一个私钥,然后从中生成一个证书请求:

    openssl genrsa -out key.pem 1024    
    openssl req -new -key key.pem -out req.pem
    

    相同但只是使用req:

    openssl req -newkey rsa:1024 -keyout key.pem -out req.pem
    

    【讨论】:

    • 许多 SSL 证书提供者需要 2048 位密钥。
    • @ptz0n,确定这只是示例文档。当然,在适当的情况下使用 2048。
    猜你喜欢
    • 1970-01-01
    • 2016-09-06
    • 1970-01-01
    • 1970-01-01
    • 2019-01-18
    • 2022-08-11
    • 1970-01-01
    • 2016-06-07
    • 2010-11-17
    相关资源
    最近更新 更多