Try jekyll serve --host=0.0.0.0
when you invoke Jekyll on the command line.
That will make Jekyll's HTTP server bind to all available IPs, rather than just to localhost
.
You can also add this to your _config.yml
with host: 0.0.0.0
. GitHub will simply ignore this when you push, so it's safe to use if you don't mind having your work openly accessible on your network.
Without --host=0.0.0.0
Jekyll will output something like this when you start up:
$ jekyll serve
[...]
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
But with --host=0.0.0.0
(or host: 0.0.0.0
in _config.yml
) you'll notice that it's listening on all interfaces (represented by 0.0.0.0
) rather than just listening on the loopback interface (represented by 127.0.0.1
)
$ jekyll serve --host=0.0.0.0
[...]
Server address: http://0.0.0.0:4000/
Server running... press ctrl-c to stop.
If you still cannot access your server then there might be a firewall stopping it. Temporarily disable your firewall, or add a port forwarding rule for port 4000.
Once Jekyll is appropriately listening on all interfaces, you can access this from your mobile device using your LAN IP address (retrieved from something like ifconfig
or ipconfig
depending on your operating system).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…