Rails、Heroku 和子域.我的特殊情况是否可行? [英] Rails, Heroku and Subdomains. Is my special case scenario feasible?

查看:25
本文介绍了Rails、Heroku 和子域.我的特殊情况是否可行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的场景:

我有一个必须支持多个客户端的应用程序.每个客户端都将获得一个子域用于那里的服务.我们还将有一个没有应用程序的宣传册网站,它只是一个关于产品以及潜在客户如何在我们这里设置帐户的网站.

I have an application that will have to support multiple clients. Each client will be given a subdomain for there service. We will also have a brochure website that doesn't have the application, its just a website about the product and how potential clients can setup an account with us.

鉴于:

www.mycoolsite.com 会指向 Heroku 上的小册子应用程序.client1.mycoolsite.comclient2.mycoolsite.comclient3.mycoolsite.com 都指向同一个 SaaS 应用程序,可以告诉每个请求和我之间的差异应该能够处理,所以他们只能看到他们的日期(即设置全局 client_id 或类似的东西)

www.mycoolsite.com would point to a brochure app on Heroku. client1.mycoolsite.com, client2.mycoolsite.com and client3.mycoolsite.com would all point to the same SaaS application that could tell the difference between each request and I should be able to handle so they only see their date (i.e. setting a global client_id or something like that)

我该怎么做?我在 DNS 方面做得并不多,所以我不知道从哪里开始.

How do I go about doing this? I haven't done a lot with DNS so I'm pretty clueless about where to start with this.

谢谢.

推荐答案

不用担心.我们现在在 Heroku 这样做.我们碰巧使用 Godaddy 作为域注册商,但任何 DNS 控制面板都可以让您做同样的事情.

No sweat. We do that now, at Heroku. We happen to use Godaddy for the domain registrar, but any DNS control panel will let you do the same thing.

我在这里读到的其他解释有点笼统,这里是具体的...

The other explanations I read here are a little general, here are the specifics...

heroku 的解释非常好,在:http://docs.heroku.com/custom-域(甚至还有一个非常好的截屏视频一步一步地展示)

The explanation at heroku is very good, at : http://docs.heroku.com/custom-domains (there's even a very good screencast shows step by step)

关键是如果您的根域 (mycoolsite.com) 位于 Heroku,您想要创建三个A"记录,因为它们会执行一些容错交叉魔术.所以你会有一个 A 记录

the key thing is if your ROOT domain (mycoolsite.com) is at Heroku you want to create THREE "A" records, because they do some fault-tolerant crossover magic. So you'd have an A record for

75.101.163.44
75.101.145.87
174.129.212.2

现在为每个子域创建一个 CNAME 记录

Now for each subdomain you create a CNAME record

www  -> proxy.heroku.com
client1 -> proxy.heroku.com
client2 -> proxy.heroku.com
client3 -> proxy.heroku.com

现在在 HEROKu 方面,您有两个应用程序,对吗?手册应用"和 saas 应用.

NOW on the HEROKu side, you have two apps right? The 'brochure app' and the saas app.

登录,对于每个应用程序,请转到资源 -> 插件 -> 获取更多插件 -> 自定义域(免费)

Login, and for each app go to Resources -> Addon -> Get More Addons ->Custom Domains (free)

对于小册子应用程序,添加一个域:www.mycoolsite.com

for the brochure app, add ONE domain: www.mycoolsite.com

对于 saas 应用程序,添加每个客户端,例如:

for the saas app, add each of the clients, eg:

client1.mycoolsite.com 
client2.mycoolsite.com 
client3.mycoolsite.com

就是这样.像冠军一样工作.玩得开心.

That's it. works like a champ. Have fun.

这篇关于Rails、Heroku 和子域.我的特殊情况是否可行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆