What is the difference between 0.0.0.0, 127.0.0.1 and localhost?

后端 未结 2 1086
执笔经年
执笔经年 2020-11-22 11:08

I am using Jekyll and Vagrant on my mac. I found that Jekyll server will bind to 0.0.0.0:4000 instead of 127.0.0.1:

2条回答
  •  梦谈多话
    2020-11-22 11:35

    In current version of Jekyll, it defaults to http://127.0.0.1:4000/.
    This is good, if you are connected to a network but do not want anyone else to access your application.

    However it may happen that you want to see how your application runs on a mobile or from some other laptop/computer.

    In that case, you can use

    jekyll serve --host 0.0.0.0
    

    This binds your application to the host & next use following to connect to it from some other host

    http://host's IP adress/4000 
    

提交回复
热议问题