How to setup sub-domains like blogspot

后端 未结 5 1468
深忆病人
深忆病人 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:27

    If your using Linux server's I'm assuming your using Apache as your webserver.

    You'll have to setup proper DNS routing for the sub domain as well as a virtual host.

    Virtual Hosts are fairly easy to setup but I'm not sure how easy it is to do them on the fly progmatically.

    Most of the time it's as easy as editing your apache config file and adding the following:

    Port 80
    ServerName www.mydomain.com
    
    NameVirtualHost *:80
    
    
    DocumentRoot /www/user-bob
    ServerName bob.mydomain.com
    ...
    
    
    
    DocumentRoot /www/user-sally
    ServerName sally.mydomain.com
    ...
     
    

    The VirtualHost Documention will probably of some use to you.

提交回复
热议问题