jekyll地址绑定127.0.0.1导致其他机器无法访问
· 阅读需 1 分钟
树莓派启动jekyll服务后本地可以访问,其他电脑不能访问
排查了iptables或其他防火墙设置没有问题,但是仍然无法访问,是由于jekyll绑定了默认ip 为127.0.0.1, 解决方法:启动脚本增加--host参数
bundle exec jekyll serve --host=0.0.0.0
排查了iptables或其他防火墙设置没有问题,但是仍然无法访问,是由于jekyll绑定了默认ip 为127.0.0.1, 解决方法:启动脚本增加--host参数
bundle exec jekyll serve --host=0.0.0.0
# sudo apt-get update
# sudo apt-get install ruby
或者
# sudo apt-get install ruby2.0
#不安装dev安装jekyll会报错
apt-get intall ruby-dev
$ tar zxvf ruby-2.4.0.tar.gz
$ cd ruby-2.4.0
$ ./configure
$ make
$ sudo make install
如果已经安装了低版本的ruby,默认安装在/usr/bin目录下,若此时执行ruby -v,还是会显示低版本的ruby,若默认使其执行2.4版本的ruby,则可通过软链接的方式实现
ruby -v
find /usr -name "ruby"
sudo rm /usr/bin/ruby
sudo ln -s /usr/local/bin/ruby /usr/bin/ruby
ruby -v
$ gem update --system # 这里请翻墙一下
$ gem -v
2.6.3
$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
$ gem sources -l
https://gems.ruby-china.com
# 确保只有 gems.ruby-china.com
$ bundle config mirror.https://rubygems.org https://gems.ruby-china.com
这样你不用改你的 Gemfile 的 source。
source 'https://rubygems.org/'
gem 'rails', '4.2.5'
...
$ gem install jekyll bundler
~ $ jekyll new my-awesome-site
~ $ cd my-awesome-site
~/my-awesome-site $ bundle install
~/my-awesome-site $ bundle exec jekyll serve
# => 打开浏览器 http://localhost:4000
Dependency Error: Yikes! It looks like you don't have jekyll-paginate or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. If you've run Jekyll with `bundle exec`, ensure that you have included the jekyll-paginate gem in your Gemfile as well. The full error message from Ruby is: 'cannot load such file -- jekyll-paginate' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
------------------------------------------------
Jekyll 4.0.0 Please append `--trace` to the `serve` command
for any additional information or backtrace.
------------------------------------------------
修改Gemfile,添加
source "https://rubygems.org"
gem "jekyll"
gem "jekyll-paginate"