9

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?

mildrenben
  • 3,675
  • 5
  • 23
  • 37
  • 2
    Possible duplicate of [Connect to a locally built Jekyll Server using mobile devices in the LAN](http://stackoverflow.com/questions/16608466/connect-to-a-locally-built-jekyll-server-using-mobile-devices-in-the-lan) – 0xcaff Nov 29 '15 at 03:48

2 Answers2

24

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.

m1keil
  • 4,515
  • 22
  • 26
  • Thanks for the answer. My PC is connected to my router via ethernet. My phone is connected via wifi. Does that mean I need to forward port 4000 on my router to my pc? How do you do this? – mildrenben Jan 21 '15 at 20:12
3

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

GorvGoyl
  • 42,508
  • 29
  • 229
  • 225