Serving Jekyll on LAN
Jekyll is a static site generator that I used for creating my website as well for this til.
Most commonly, for making the Jekyll site available to localhost, the command used is -
bundle exec jekyll serve
While serving it on the localhost, I felt the need of serving it to the whole network. Doing that will allow the blogger/developer to test the website on smartphones or other devices while making the changes.
For serving on the complete local area network, use --host
flag along with the value 0.0.0.0
.
bundle exec jekyll serve --host=0.0.0.0
Now you can go to your system’s internal IP address with the assigned port number (default: 4000).
For finding out your system’s internal IP address, use this command (source) -
ip -4 addr | grep -oP '(?<=inet\s)\d+(\.\d+){3}'
NOTE - It will list out all the IPv4 interfaces. Usually, the internal IP address starts with
192.168.X.X
.