mildrenben
mildrenben

Reputation: 3757

How to access localhost on mobile when using Jekyll

So I've searched google a lot, and I've tried everything everyone is suggesting but nothing seems to be working.

I want to view my jekyll website on my mobile.

When I run jekyll it says server address: 127.0.0.1:4000

My computer's IP is 154.135.X.Y

I've opened up the port in the windows inbound rules

I've tried accessing from my mobile using both 154.135.X.Y:4000 and 127.0.0.1:4000 but to no avail.

Anyone know how I can access my jekyll site on mobile?

Upvotes: 9

Views: 5027

Answers (2)

GorvGoyl
GorvGoyl

Reputation: 49350


TiP: use {{site.baseurl}}/ to add images/assets in the pages and make sure there's no url:~ key in _config.yml

Upvotes: 3

m1keil
m1keil

Reputation: 4575

If your server address is 127.0.0.1 it means Jekyll is only listening on your localhost. You'll need to start Jekyll and instruct it to bind to port 4000 on ANY interface:

jekyll serve --host 0.0.0.0
Configuration file: none
Auto-regeneration: enabled for '/private/tmp/test'
Configuration file: none
    Server address: http://0.0.0.0:4000/
  Server running... press ctrl-c to stop.

If you are accessing the computer from the web, you'll need to make sure your router forwards port 4000 to your PC.

If you are accessing the computer from your local LAN, make sure you accessing the private IP of your computer, and not the public IP.

Obviously you need to make sure there's not firewall that blocks incoming connections on your PC as well.

Upvotes: 24

Related Questions