使用openssl为localhost创建csr

时间:2013-01-13 23:02:30

标签: openssl csr

我正在使用openssl(在Windows上)创建一个csr来使用(测试试用版)证书。我以前从未这样做过,我有一个问题: 创建私钥后,您创建一个csr文件,并要求您提供个人信息。它问你的一件事是Common Name,这意味着域名。我目前只是在运行localhost。我正在练习如何创建一个https://站点。

问题:我可以通过执行localhost:82之类的操作来创建有效的csr吗?如果没有,我该怎么办?

1 个答案:

答案 0 :(得分:4)

简单回答:打开您的hosts文件(C:\ Windows \ System32 \ drivers \ etc \ hosts)并提出一个精美的域名:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#       ::1             localhost
127.0.0.1       localhost

127.0.0.1       example.com  # <<< Your fancy domain goes here !!!

然后,告诉您的网络服务器向example.com提供HTTPS请求。