我正在使用 openssl (在 Windows 上)创建一个 csr 以使用(测试试用)证书。我以前从未这样做过,我有一个问题:创建私钥后,您创建了一个 csr 文件,并要求您提供个人信息。它要求您做的一件事是 Common Name,即域名。我目前只运行本地主机。我正在练习如何创建一个 https:// 网站。
问题:我可以通过执行 localhost:82 之类的操作来创建有效的 csr 吗?如果没有,我该怎么办?
简单的答案:打开你的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 !!!
然后,告诉您的网络服务器将 HTTPS 请求提供给example.com
.