Heroku 上的 Jekyll 博客
我正在尝试在 heroku 上建立一个 jekyll 博客。这是我的目录结构,
.
├── Gemfile
├── Gemfile.lock
├── _layouts
│ └── default.html
├── _posts
├── _site
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── config.ru
│ └── index.html
├── config.ru
└── index.html
我的 Gemfile 拥有
source "http://rubygems.org"
gem 'jekyll'
,只有其中包含任何内容的其他文件是 index.html
,
Hello world!
如果我运行 jekyll --server
它在本地运行良好。但是如果我git push heroku master
(检查完所有内容后)我的heroku日志中会出现此错误
!! Unexpected error while processing request: undefined method `[]' for nil:NilClass
如何让我的jekyll博客在Heroku上工作?
I'm trying to setup a jekyll blog on heroku. This is my dir structure
.
├── Gemfile
├── Gemfile.lock
├── _layouts
│ └── default.html
├── _posts
├── _site
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── config.ru
│ └── index.html
├── config.ru
└── index.html
My Gemfile has
source "http://rubygems.org"
gem 'jekyll'
and only other file with anything in it is index.html
with
Hello world!
If I run jekyll --server
it runs fine locally. But if I git push heroku master
(after checking everything in) I get this error in my heroku logs
!! Unexpected error while processing request: undefined method `[]' for nil:NilClass
How can I get my jekyll blog to work on Heroku?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我同意phsr的回答。使用亚马逊 CDN 或类似的东西可能会更好地为静态网站提供服务。不过要回答你的问题:
I agree with phsr's answer. Static websites might be better served using amazon CDN or something similar. However to answer your question:
Jekyll 生成静态 HTML 文件,因此不需要使用 Heroku。将其托管在 S3 上会是一个更好的主意。请参阅这篇亚马逊博客文章 在 S3 上托管静态站点。使用 AWS 免费套餐,您的网站在第一年将完全免费(只要其大小低于 5 GB),之后每月只需花费几美分
Jekyll generates static HTML files, so there is no need to use Heroku. It would be a better idea to host it on S3. See this Amazon blog post on hosting a static site on S3. With the AWS Free tier, your site would be completely free for the first year (as long as it's under 5 GB in size), and would cost pennies a month after that
我在 Heroku 上运行 jekyll 博客时遇到了很多问题,但最终还是成功了。
如果这仍然相关,您可以在 github 上查看完整代码: https://github.com/ramijames/Blueverve_public
您可以克隆并推送到 Heroku 应用程序,并在那里进行实际设置。
I had a lot of problems getting a jekyll blog running on Heroku, but managed it in the end.
If this is still relevant, you can see the full code here on github: https://github.com/ramijames/Blueverve_public
You can clone and push to a heroku app and fiddle with the actual setup there.