How to setup sub-domains like blogspot

后端 未结 5 1392
深忆病人
深忆病人 2021-02-06 16:48

What should do to setup a sub-domain for the users when they sign-up into my site.

What are the infrastructure required? I am using Linux servers.

5条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 17:19

    Apache allows you to specify any number of 'sites' based on subdomains on a single server. Creating a new 'site definition' file with the appropriate subdomain information in it, along with proper DNS wildcards, will do what you want.

    In other words, the process is like this:

    1. Setup wildcards so that *.mysite.com directs to the proper server.
    2. When a new user signs up, create the proper Apache site definition file - you'll probably have a base template that you put the right subdomain information into and save.
    3. Make Apache re-read its configuration.
    4. Profit.

    IMPORTANT This is based on a Debian-style Apache configuration, where the config files are included in a directory, and the main configuration reads all the config files in that directory. This will simplify things a great deal, because adding/removing subdomains will mean adding/removing files, rather than editing a single file, and so the process will be much easier to automate.

提交回复
热议问题