yii2 + nginx,子域到模块

I have a project working on yii2 (backend nginx). The project has several modules, it can be conditionally called:

  • Category 1 (cat1)
  • Category 2 (cat2)

It is required to implement the functionality so that when requesting cat1.coolsite.example, it opens a module that is available as coolsite.example/cat1. Accordingly, the second category

Try adding 2 server configs for your modules like this one and look at nginx error.log if it doesn't do the trick.

server {

    listen 80;

    server_name cat1.coolsite.example,;

    location / {
            proxy_pass coolsite.example/cat1/$uri;
    }
}