douzhuozhu9544 2011-08-16 07:16
浏览 122
已采纳

使用PHP进行网站复制

I would like to know the concept of website replication where when a user sign up a subdomain is created and the user can create his website online. Just the way it is being done in www.empowerkit.com

  • 写回答

3条回答 默认 最新

  • dongyuzhu2244 2011-08-16 07:47
    关注

    Lots of ways to structure multi-tenant SaaS.

    There is the single site, single database database approach:

    Basically you have the website binding listen to * on a dedicated IP Address.

    DNS Bind *.yourdomain.com to ip address

    Have your signup function create a customer database record containing the subdomain.

    Have routing code that can determine what the customer id is for a specific request on a subdomain, then use row-level filtering in your data repository to only return data for that specific customer id.

    You could also have your code create a whole separate website on the filesystem, and add the appropriate virtualhosts entries for the new site.

    Pros: Less database overheads from multiple database instances, easy to backup and restore (single database) Cons: Bit more working getting the data access, harder to shard

    Then there is single-site, multi-database:

    Same as above, but the subdomain maps to a specific customer database.

    Pros: Easier to shard, Customer database better segregated

    Cons: High memory overhead, requires lots of database instances, hard to backup

    Finally, multi-site multi-database

    You create separate physical sites and add the appropriate virtualhost records for your clients during signup, as well as creating a separate database for that client

    Pros: Simple application code, easy to scale, better user segregation, easier to customize "per user" if required.

    Cons: Complex "signup code", requires lots of resources, requires your application to have write access to important configuration files, wastes lots of disk space.

    It depends on how your application works and what per user customization you offer.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型