结合Octopress和Rails 4.0应用程序?

pro*_*ons 8 rack ruby-on-rails octopress ruby-on-rails-4

据我所知,Octopress旨在作为独立的Web应用程序运行.

我有一个个人网站,我想添加一个博客,由于种种原因我想使用Octopress.我想将这些应用程序集成在一起,而不是在git中有两个单独的应用程序和repos.

有没有可靠的方法将Octopress集成到现有的Rails 4.0应用程序中?

我最好的办法是将Octopress作为机架应用程序安装在Rails路由器中,还是有更好的方法?

wes*_*que 1

我认为你最好的选择是拥有一个像 nginx 这样的前端服务器作为反向代理,并从那里进行重定向/代理。

所以你会得到nginx.conf类似的东西:

server {
  listen 80;
  server_name domain.com;
  location / {
    # ... proxy config stuff to rails ...
  }
}

server {
  listen 80;
  server_name blog.mydomain.com;
  location / {
    root /to/octopress/static/folder
  }
}
Run Code Online (Sandbox Code Playgroud)

我的例子是如果您使用子域blog.domain.com。但显然,如果你有domain.com/blog,它仍然可以工作,只需对nging.conf文件进行一些调整即可。