向 NGINX 单元添加多个应用程序和侦听器

Add multiple application and listeners to NGINX unit

起初我是这样设置应用程序服务器的。

firstapp.json

 {
      "listeners": {
          "*:8008": {
              "pass": "applications/first"
          }
      },
      "applications":{
         "first":{
              "type":"python 3.8",
              "module":"firstapp.wsgi",
              "home":"/home/ubuntu/anaconda3/envs/firstapp/",
              "path":"/var/www/html/firstapp/current"
         }
      }
  }

sudo curl -X PUT -d @/home/ubuntu/firstapp.json --unix-socket /run/control.unit.sock http://localhost/config

那我要添加secondapp设置,

secondapp.json

 {
      "listeners": {
          "*:8009": {
              "pass": "applications/second"
          }
      },
      "applications":{
          "second":{
              "type":"python 3.8",
              "module":"secondapp.wsgi",
              "home":"/home/ubuntu/anaconda3/envs/secondapp/",
              "path":"/var/www/html/secondapp/current"
          }
      }
  }

sudo curl -X PUT -d @/home/ubuntu/secondapp.json --unix-socket /run/control.unit.sock http://localhost/config

可以注册但是,它会覆盖第一个设置。

如何将第二个应用程序添加到设置中???

{
  "listeners": {
      "*:8008": {
          "pass": "applications/first"
      },
       "*:8009": {
          "pass": "applications/second"
      }
  },
  "applications":{
     "first":{
          "type":"python 3.8",
          "module":"firstapp.wsgi",
          "home":"/home/ubuntu/anaconda3/envs/firstapp/",
          "path":"/var/www/html/firstapp/current"
     },
      "second":{
          "type":"python 3.8",
          "module":"secondapp.wsgi",
          "home":"/home/ubuntu/anaconda3/envs/secondapp/",
          "path":"/var/www/html/secondapp/current"
      }
    } 
}

把它们合二为一json