在 Windows 上为 localhost 设置 local.host 别名

All*_*lly 2 node.js everyauth

我正在尝试为我的节点应用程序设置 everyauth。尽管我已经达到了我不知道如何完成的一步。

它要求设置local.host为 的别名localhost,但它引用了一些 linux 文件夹,我使用的是 windows。

这是我所困惑的确切说明。

重要提示 - 某些 OAuth 提供程序不允许回调到 localhost,因此您需要创建一个名为 local.host 的 localhost 别名。确保设置 /etc/hosts,以便 127.0.0.1 也与“local.host”关联。因此,在 /etc/hosts 文件中,其中一行将如下所示:“127.0.0.1 localhost local.host”

(来源在这里)

在 Windows 上如何实现这一点?

Vin*_*243 7

这可以通过编辑文件来完成hosts。以管理员身份打开记事本++(或记事本)。然后点击打开,然后选择C:\Windows\System32\drivers\etc\hosts。你会看见:

# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# ...
#
# 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

127.0.0.1       localhost
::1             localhost
Run Code Online (Sandbox Code Playgroud)

并在末尾添加这一行:

127.0.0.1       local.host
Run Code Online (Sandbox Code Playgroud)

保存即可完成