From c3e44c8c12897a3dccc98dff19a231d04e95d8c7 Mon Sep 17 00:00:00 2001 From: FengGu Date: Thu, 18 Dec 2025 11:17:38 +0800 Subject: [PATCH] Core: Don't create temp directories when tesing configurations. If no user directive is set in nginx.conf and Nginx is started by a non-root account (e.g., `nginx`), the temporary directories is created with owner `nginx`. Later, when root runs `nginx -t`, it changes the owner of that temp directories to `nobody`, causing the running worker processes to lose permission to read the temp directories. --- src/core/ngx_cycle.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c index a75bdf878..7a7dda7e5 100644 --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -351,8 +351,10 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) } - if (ngx_create_paths(cycle, ccf->user) != NGX_OK) { - goto failed; + if (!ngx_test_config) { + if (ngx_create_paths(cycle, ccf->user) != NGX_OK) { + goto failed; + } }