How to setup mass dynamic virtual hosts in nginx?

前端 未结 7 1814
借酒劲吻你
借酒劲吻你 2021-01-30 09:42

Been playing with nginx for about an hour trying to setup mass dynamic virtual hosts. If you ever done it in apache you know what I mean.

Goal is to have dynamic subdom

7条回答
  •  爱一瞬间的悲伤
    2021-01-30 10:13

    Perhaps doing this will get you where you want to be:

    server {
    
        root /sites/$http_host;
    
        server_name $http_host;
    
        ...
    
    }
    

    I like this as I can literally create sites on the fly, just create new directory named after the domain and point the DNS to the server ip.

提交回复
热议问题