From 0e20f1fb0fd0cef31f196f166088f60228a86e4a Mon Sep 17 00:00:00 2001 From: Sergey Kandaurov Date: Mon, 19 Oct 2026 15:53:30 +0000 Subject: [PATCH] Core: working_directory relative to prefix Previously, a relative path was resolved against the current working directory of the master process, which depends on how nginx is started. Now it is resolved relative to prefix, similar to pid and error_log. --- src/core/nginx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/nginx.c b/src/core/nginx.c index d827f3fc9..88f22483f 100644 --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -1231,6 +1231,13 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf) NGX_OLDPID_EXT, sizeof(NGX_OLDPID_EXT)); + if (ccf->working_directory.len) { + if (ngx_conf_full_name(cycle, &ccf->working_directory, 0) != NGX_OK) { + return NGX_CONF_ERROR; + } + } + + #if !(NGX_WIN32) if (ccf->user == (uid_t) NGX_CONF_UNSET_UINT && geteuid() == 0) {