在 Windows 10 上无法连接到 Jekyll 的 localhost:4000 [英] Can't connect to Jekyll's localhost:4000 on Windows 10
问题描述
我正在尝试在我的 Windows 10 机器上设置 Jekyll,但无法连接到由 jekyll serve
(或 bundle exec jekyll serve
).我已按照 Julian Thilo 的 Run Jekyll on Windows 中的所有步骤进行操作没有任何错误信息.当我从 Jekyll 网站文件夹在 PowerShell 中运行 jekyll serve
时,一切似乎都很好:
I'm trying to set up Jekyll on my Windows 10 machine, but can't connect to the website (127.0.0.1:4000) that is created by jekyll serve
(or bundle exec jekyll serve
). I have followed all the steps in Julian Thilo's Run Jekyll on Windows without any error messages. And when I run jekyll serve
in PowerShell from my Jekyll website folder everything seems just fine:
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),连接失败.
But when I open http://127.0.0.1:4000 (or http://localhost:4000) in my browser, the connection fails.
当我运行 netstat -an
时,端口 4000
被列为
When I run netstat -an
, the port 4000
is listed as
Proto Local Address Foreign Address State
TCP 127.0.0.1:4000 0.0.0.0:0 LISTENING
我以前设法使用 IIS 设置了本地主机,但该网站现在已停止.
I have previously managed to set up a localhost using IIS, but that website is stopped now.
这个 Github 问题 似乎相关,但没有包含足够的信息给我找出问题是如何解决的.它只说使用Windows 包上的 Jekyll",但我找不到任何相关信息.
This Github issue seems related, but doesn't contain enough information for me to figure out how the problem was solved. It only says to use the "Jekyll on windows package", but I can't find any information on that.
推荐答案
跟随@Fredrik P 的脚步,我 CD 进入项目的 _site
文件夹(这是服务器的主文件夹所在的位置应该)并运行 Python 3.x 简单 HTTP 服务器:
Following in @Fredrik P's footsteps, I CD'd into the project's _site
folder (this is where the home folder of the server should be) and ran a Python 3.x simple HTTP server:
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/
就像一个魅力.
Now pointing my browser to http://0.0.0.0:3999/
works like a charm.
如果您需要使用 Python 2.x,则 HTTP 服务器命令为:
If you need to use Python 2.x, the HTTP server command would be:
python -m SimpleHTTPServer 3999
有关 SimpleHTTPServer
(2.x) 和 http.server
(3.x) 的更多信息,请参阅 这篇 Stack Overflow 帖子.
For more information regarding SimpleHTTPServer
(2.x) and http.server
(3.x), see this Stack Overflow post.
这篇关于在 Windows 10 上无法连接到 Jekyll 的 localhost:4000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!