nginx - two subdomain configuration

后端 未结 5 973
耶瑟儿~
耶瑟儿~ 2020-12-23 13:17

I\'m new to Nginx and I\'m trying to get subdomains working.

What I would like to do is take my domain (let\'s call it example.com) and add:

    <
5条回答
  •  感情败类
    2020-12-23 14:04

    The mistake is putting a server block inside a server block, you should close the main server block then open a new one for the sub domains

    server {
        server_name example.com;
        # the rest of the config
    }
    server {
        server_name sub1.example.com;
        # sub1 config
    }
    server {
        server_name sub2.example.com;
        # sub2 config
    }
    

提交回复
热议问题