diff options
author | Valentin Bartenev <vbart@nginx.com> | 2020-05-14 13:15:01 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2020-05-14 13:15:01 +0300 |
commit | 376d758dd72ac27f2bd5bb833ba68f5c9b531880 (patch) | |
tree | a3891a0586669543c35004ccbff3a6deca893903 /src/nxt_main_process.c | |
parent | 0174c971b5ec0d604e4e9becfa41e0bc31179e57 (diff) | |
download | unit-376d758dd72ac27f2bd5bb833ba68f5c9b531880.tar.gz unit-376d758dd72ac27f2bd5bb833ba68f5c9b531880.tar.bz2 |
PHP: implemented "targets" option.
This allows to specify multiple subsequent targets inside PHP applications.
For example:
{
"listeners": {
"*:80": {
"pass": "routes"
}
},
"routes": [
{
"match": {
"uri": "/info"
},
"action": {
"pass": "applications/my_app/phpinfo"
}
},
{
"match": {
"uri": "/hello"
},
"action": {
"pass": "applications/my_app/hello"
}
},
{
"action": {
"pass": "applications/my_app/rest"
}
}
],
"applications": {
"my_app": {
"type": "php",
"targets": {
"phpinfo": {
"script": "phpinfo.php",
"root": "/www/data/admin",
},
"hello": {
"script": "hello.php",
"root": "/www/data/test",
},
"rest": {
"root": "/www/data/example.com",
"index": "index.php"
},
}
}
}
}
Diffstat (limited to '')
-rw-r--r-- | src/nxt_main_process.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c index eed37752..c35954c0 100644 --- a/src/nxt_main_process.c +++ b/src/nxt_main_process.c @@ -275,21 +275,9 @@ static nxt_conf_map_t nxt_python_app_conf[] = { static nxt_conf_map_t nxt_php_app_conf[] = { { - nxt_string("root"), - NXT_CONF_MAP_CSTRZ, - offsetof(nxt_common_app_conf_t, u.php.root), - }, - - { - nxt_string("script"), - NXT_CONF_MAP_STR, - offsetof(nxt_common_app_conf_t, u.php.script), - }, - - { - nxt_string("index"), - NXT_CONF_MAP_STR, - offsetof(nxt_common_app_conf_t, u.php.index), + nxt_string("targets"), + NXT_CONF_MAP_PTR, + offsetof(nxt_common_app_conf_t, u.php.targets), }, { @@ -457,6 +445,8 @@ nxt_port_main_start_worker_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) } } + app_conf.self = conf; + ret = nxt_main_start_worker_process(task, task->thread->runtime, &app_conf, msg->port_msg.stream); |