在 Windows 10 上无法连接到 Jekyll 的 localhost:4000
Posted
技术标签:
【中文标题】在 Windows 10 上无法连接到 Jekyll 的 localhost:4000【英文标题】:Can't connect to Jekyll's localhost:4000 on Windows 10 【发布时间】:2018-11-10 07:23:18 【问题描述】:我正在尝试在我的 Windows 10 机器上设置 Jekyll,但无法连接到由 jekyll serve
(或 bundle exec jekyll serve
)创建的网站 (127.0.0.1:4000)。我已按照 Julian Thilo 的 Run Jekyll on Windows 中的所有步骤操作,没有任何错误消息。当我从我的 Jekyll 网站文件夹中的 PowerShell 中运行 jekyll serve
时,一切似乎都很好:
Configuration file: C:/Users/fredr/dropbox/github/jekyll-website/_config.yml
Source: C:/Users/fredr/dropbox/github/jekyll-website
Destination: C:/Users/fredr/dropbox/github/jekyll-website/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 0.457 seconds.
Auto-regeneration: enabled for 'C:/Users/fredr/dropbox/github/jekyll-website'
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
但是当我在浏览器中打开http://127.0.0.1:4000(或http://localhost:4000)时,连接失败。
当我运行netstat -an
时,端口4000
被列为
Proto Local Address Foreign Address State
TCP 127.0.0.1:4000 0.0.0.0:0 LISTENING
我之前设法使用 IIS 设置了一个本地主机,但该网站现在已停止。
This Github issue 似乎相关,但没有包含足够的信息让我弄清楚问题是如何解决的。它只说使用“Jekyll on windows package”,但我找不到任何相关信息。
【问题讨论】:
你试过localhost:4000
吗?
@JoostS 很多很多次 :(
【参考方案1】:
跟随 @Fredrik P 的脚步,我 CD 到项目的 _site
文件夹(这应该是服务器的主文件夹)并运行 Python 3.x 简单 HTTP 服务器:
D:\frida\frida-website\_site>python -m http.server 3999
Serving HTTP on 0.0.0.0 port 3999 (http://0.0.0.0:3999/) ...
现在将我的浏览器指向http://0.0.0.0:3999/
就像一个魅力。
如果您需要使用 Python 2.x,HTTP 服务器命令为:
python -m SimpleHTTPServer 3999
有关SimpleHTTPServer
(2.x) 和http.server
(3.x) 的更多信息,请参阅this Stack Overflow post。
【讨论】:
【参考方案2】:在出现更好的解决方案之前,我将使用 IIS 托管 _site
文件夹。不像花哨的花哨,但就像一个魅力:)
【讨论】:
以上是关于在 Windows 10 上无法连接到 Jekyll 的 localhost:4000的主要内容,如果未能解决你的问题,请参考以下文章
无法通过运行 OpenSSH 的 SSH 连接到 Windows 10
无法在 Windows 机器上使用 sqlalchemy 连接到本地 mysql 数据库
无法在远程系统上使用 Windows 身份验证连接到 ms sql server
我们无法在此设备上激活windows因为无法连接到你的组织的激活服务器