Home > Net >  Add multiple application and listeners to NGINX unit
Add multiple application and listeners to NGINX unit

Time:12-28

At first I setup application server like this.

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

then I want to add secondapp setting,

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

It could be registered but,It overwrites the first setting.

How can I add the seccond app to the setting???

CodePudding user response:

{
  "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"
      }
    } 
}

just combine them into one json

  • Related