【问题标题】:Add multiple application and listeners to NGINX unit向 NGINX 单元添加多个应用程序和侦听器
【发布时间】:2021-12-28 01:06:41
【问题描述】:

一开始我是这样设置应用服务器的。

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

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

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

【问题讨论】:

    标签: python http nginx-unit


    【解决方案1】:
    {
      "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

    【讨论】:

    • 非常感谢,所以我需要一直合并我添加server??不过很容易理解,非常感谢
    猜你喜欢
    • 1970-01-01
    • 2017-04-28
    • 2019-12-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-01
    • 1970-01-01
    • 2014-01-30
    • 1970-01-01
    相关资源
    最近更新 更多