Connecting to a locally built Jekyll server using mobile devices on the local network

After using jekyll serve , the WEBrick server is configured on one computer, and on this site you can access from localhost:4000 on this PC.

However, I am wondering how to access this web server from other computers on the local network, especially for mobile devices? I am trying to check jekyll website on mobile devices before pushing the code on Github.

+53
github ruby webrick jekyll
May 17 '13 at 11:59
source share
2 answers

Try jekyll serve --host=0.0.0.0 when invoking Jekyll on the command line.

This will make the Jekyll HTTP server tied to all available IP addresses, not just localhost .

You can also add this to your _config.yml with host: 0.0.0.0 . GitHub will simply ignore it when you click, so it’s safe to use it if you don’t mind opening your work on your network.




Without --host=0.0.0.0 Jekyll will output something like this at startup:

 $ 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 will notice that it listens on all interfaces (represented by 0.0.0.0 ), and not just listens 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. 
+120
May 17 '13 at 12:11
source share

Assuming your mobile device is connected to the same local network as your development machine.

  • Determine the LAN IP address of your development machine. Usually something like: 192.168.0.XXX. Where .XXX is the unique last 3 digits of your local network.

  • Point the browser of your mobile device to: http : //192.168.0.XXX-00-00000

How I do it on my laptop and iPhone for Jekyll dev.

-7
May 18 '13 at 22:11
source share



All Articles