Unit: how to config listeners with domain:port

Created on 15 Apr 2018  Â·  5Comments  Â·  Source: nginx/unit

webs.json

{
  "listeners": {
    "app1.com:80": {
      "application" : "app1"
    },
    "app2.com:80": {
      "application" : "app2"
    }
  },
  "applications": {
    "app1" : {
      "type": "php",
      "processes": 1,
      "root" : "/home/codes/php-apps/app1",
      "index":"index.php"
    },
    "app2" : {
      "type": "php",
      "processes": 1,
      "root" : "/home/codes/php-apps/app2",
      "index":"index.php"
    }
  }
}

/etc/hosts

127.0.0.1       app1.com
127.0.0.1       app2.com

when i put this json file, i get

➜  ~ curl -X PUT -d @webs.json 127.0.0.1:8443
{
    "error": "Failed to apply new configuration."
}
➜  ~
question

Most helpful comment

When the feature is sheduled for release?

All 5 comments

Unfortunately, only the format "ip:port" is supported currently.

There's no virtual servers support at the moment. You have to specify different ip:port for each application.

This feature is planned. Currently, for virtual servers it's recommended to use nginx in front.

@VBart what about e.g. *:80/api (routing based on paths)?

@almarklein Unit will have routing capabilities equal to nginx.

When the feature is sheduled for release?

Was this page helpful?
0 / 5 - 0 ratings