如何创建 SaaS 应用程序? [英] How to create an SaaS Application?

查看:50
本文介绍了如何创建 SaaS 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道还能怎么说,所以我只是想解释一下我的理想情况,希望你能向我解释如何实现它...

I don't know how else to say it so I'm just going to explain my ideal scenario and hopefully you can explain to me how to implement it...

我正在使用 Zend 框架创建一个应用程序,该应用程序将由 DreamHost 托管.该应用程序将托管在其自己的域(即 example-app.com)上.基本上,用户应该能够注册,获得他们自己的域 sampleuser.example-app.com 或 example-app.com/sampleuser 指向,看起来像他们自己的应用程序实例,这实际上是单个实例根据网址提供不同的内容.

I'm creating an application with the Zend Framework that will be hosted with DreamHost. The application will be hosted on its own domain (i.e. example-app.com). Basically, a user should be able to sign up, get their own domain sampleuser.example-app.com or example-app.com/sampleuser which points to, what looks like their own instance of the app, which is really a single instance serving up different content based on the url.

最终,我希望我的用户能够创建自己的域(如 foobar.com),指向 sampleuser.example-app.com,这样 foobar.com 的访问者就不会注意到该站点是真的由 example-app.com 提供.

Eventually, I want my users to be able to create their own domain (like foobar.com) that points to sampleuser.example-app.com, such that visitors to foobar.com don't notice that the site is really being served up from example-app.com.

我不知道如何做大部分事情.这个过程是如何运作的?我需要用 Apache 做一些时髦的事情还是可以用第三方主机来完成,比如 DreamHost?

I don't know how to do most of that stuff. How does this process work? Do I need to do some funky stuff with Apache or can this be done with a third party host, like DreamHost?

更新:感谢您的建议!我决定硬着头皮升级我的托管计划以使用通配符子域.它比我预期的要便宜!我还发现了具有自己 API 的域经销商程序,例如 opensrs.com.我认为使用这些 API 之一可以解决我的域注册问题.

Update: Thanks for the advice! I've decided to bite the bullet and upgrade my hosting plan to utilize wildcard subdomains. It's cheaper than I was expecting! I also found out about domain reseller programs, like opensrs.com, that have their own API. I think using one of these APIs will be the solution to my domain registration issue.

推荐答案

子域很容易.在托管环境中,在大多数情况下,apache 被配置为捕获主域下的所有子域调用.您只需要定义一个通配符 DNS,因此 *.example-app.com 指向您服务器的 IP.然后,您的网站应该能接收到所有对这些子域名的调用.

Subdomains are easy. In hosting environements, in most cases, apache is configured to catch all subdomain calls below the main domain. You just need to have a wildcard DNS defined, so *.example-app.com are pointed to IP of your server. Then your website should catch all calls to those subdomain names.

其他域很难.它们需要在 Apache 中配置为虚拟主机 - 请参阅 http://httpd.apache.org/docs/1.3/vhosts/name-based.html - 这意味着很难实现自动化,尤其是在托管环境中 - 除非您的主机为您提供一些 API 来做到这一点(简单且更可行的方案是为您的网站分配一个独特的 IP,然后您可以使用 Apache 捕获所有内容 - 可能可以使用您的主机控制面板进行配置或开箱即用 - 然后只需将 DNS 服务器指向您的 IP).

Other domains are hard. They need to be configured as virtual hosts in Apache - see http://httpd.apache.org/docs/1.3/vhosts/name-based.html - that means it will be difficult to automate that, especially in hosting environement - unless your host gives you some API to do just that (easy and more feasible scenario would be to have a distinctive IP assigned to your website, then you can catch all with your Apache - it's probably possible to configure using your hosting control panel or works out of the box - and then just point DNS servers to your IP).

然后,在您将 Apache 配置为将所有必要的调用指向您的网站后,您可以通过以下方式区分每个子域的应用程序分区:

Then, after you have configured your Apache to point all necessary calls to your website, you can differnetiate application partitions per subdomain in this way:

  • 从 HTTP 请求中获取主机头
  • 有一个包含您服务的所有子域名的数据库表
  • 查找该数据库表以确定实例或用户 ID,如果您将使用每个应用程序实例的数据库"架构,则稍后将其用于过滤数据/或选择数据库.

祝你好运:)

这篇关于如何创建 SaaS 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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