简体   繁体   English

Heroku Rails应用程序集成了Bluehost Wordpress网站

[英]Heroku Rails app integrated a Bluehost Wordpress site

I have a Rails 4.0 app hosted on Heroku and a Wordpress site hosted on BlueHost. 我在Heroku上托管了Rails 4.0应用程序,在BlueHost上托管了Wordpress网站。

I'd like to have certain paths forwarded, not redirected, from either the Rails app to Wordpress or the other way around. 我想将某些路径从Rails应用程序转发到Wordpress或以其他方式转发而不是重定向。 It doesn't really matter which is the 'master'. 哪个是“主”并不重要。

Doing this all hosted on the same box with something like Apache is super easy, but not with my setup. 使用Apache之类的东西将它们全部托管在同一个盒子中非常容易,但是用我的设置却不容易。

I've added Rack::Proxy to my Rails middleware stack and can successfully proxy specific paths, eg fullpath =~ /^\\main/. 我已经在我的Rails中间件堆栈中添加了Rack :: Proxy,并且可以成功代理特定路径,例如fullpath =〜/ ^ \\ main /。

I've setup the Wordpress site to be at www.insf.me and my Rails app on Heroku to be www.instructifyme.com. 我已经将Wordpress网站设置为www.insf.me,并将我在Heroku上的Rails应用程序设置为www.instructifyme.com。

When I hit www.instructifyme.com/main it forwards over to the Wordpress site, with /main/ stripped off. 当我访问www.instructifyme.com/main时,它将转发到Wordpress网站,并删除/ main /。

Now the problems: 现在的问题:

This ends with up, somehow, redirecting to www.insf.me. 最终以某种方式重定向到www.insf.me。 The proxy does work okay, but Wordpress seems to be doing the redirect. 代理确实可以正常工作,但Wordpress似乎正在执行重定向。

  • The WordPress Address (URL) is set to www.insf.me WordPress地址(URL)设置为www.insf.me
  • The Site Address (URL) is set to www.insf.me 网站地址(URL)设置为www.insf.me

I've alternately tried setting Site Address to www.instructifyme.com but no love there. 我已经尝试将“站点地址”设置为www.instructifyme.com,但那里没有任何帮助。

It seems I'm pretty close, but not close enough ;) 看来我已经很接近了,但还不够接近;)

Any help, or totally alternate ideas, would be great. 任何帮助,或完全替代的想法,都是很好的。

Thanks - Charlie 谢谢-查理

Why? 为什么?

Wordpress & RoR are both great, but are like oil & water - they don't mix very well Wordpress和RoR都很棒,但是就像油和水一样-它们混合得不好

If you're trying to run two applications side-by-side, regardless of how , I'd highly recommend looking at why 如果你想运行两个应用程序并排侧,不管如何 ,我会强烈建议在寻找原因

The bottom line is that what you're asking goes against the Rails conventions of Convention over Configuration . 最重要的是,您要问的是违背Rails约定而不是Configuration约定 You'll spend more time setting it up than actually making great functionality 您将花费更多的时间来进行设置,而不是实际使用出色的功能


CMS CMS

If you need to have a CMS part to your Rails app, then I would endeavour to build one (especially as a simple blog app can be done in as little as 15 minutes ) 如果您需要在Rails应用程序中包含CMS部分,那么我将努力构建一个(特别是因为一个简单的博客应用程序可以在15分钟之内完成

You can probably replicate much of the base-functionality of WP in a couple of days, making it more robust & custom-specced to your own needs. 您可能在几天之内就可以复制WP的许多基本功能,从而使其更加健壮并根据您的需求进行定制。 It will also add to your experience as a Rails dev :) 它也将增加您作为Rails开发人员的经验:)


Functionality 功能

If you're looking to add extra functionality to Wordpress, you might want to consider writing a plugin for it. 如果您想为Wordpress添加额外的功能,则可能需要考虑为其编写插件 WP's main draw is extensibility, so writing a plugin would be a great addition to their community WP的主要吸引力在于可扩展性,因此编写插件将是其社区的一大福音。

If you're looking to include a Rails backend to your Wordpress site (maybe you have orders or something), I'd look at using an API to link the two systems. 如果您希望将Rails后端包括到您的Wordpress网站(也许您有订单),那么我会考虑使用API​​链接两个系统。 You can create a Rails API relatively simply, allowing you to send data to your Rails app directly from WP 您可以相对简单地创建Rails API ,允许您直接从WP将数据发送到Rails应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM