我知道 Octopress 旨在作为独立的 Web 应用程序运行。
我有一个个人网站,我想在其中添加一个博客,出于多种原因,我想为此使用 Octopress。我不想在 git 中有两个单独的应用程序和存储库,而是想将这些应用程序集成在一起。
有没有可靠的方法将 Octopress 集成到现有的 Rails 4.0 应用程序中?
我最好的选择是将 Octopress 作为 Rack 应用程序安装在 Rails 路由器内,还是有更好的方法?
最佳答案
我认为最好的办法是将像 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
}
}
我的例子是,如果您使用子域
blog.domain.com
.但显然如果你有 domain.com/blog
,它仍然可以工作,只需对 nging.conf
做一些调整文件。
关于ruby-on-rails - 结合 Octopress 和 Rails 4.0 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17465429/