[nginx] Core: fixed working_directory to be resolved from prefix.
    Maxim Dounin 
    mdounin at mdounin.ru
       
    Fri Oct 31 20:43:14 UTC 2025
    
    
  
details:   http://freenginx.org/hg/nginx/rev/573101bb9ec0
branches:  
changeset: 9430:573101bb9ec0
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Fri Oct 31 08:07:54 2025 +0300
description:
Core: fixed working_directory to be resolved from prefix.
Previously, relative values of working_directory set in the configuration
were not processed with ngx_conf_full_name() and therefore resolved from
the process current working directory, leading to changes in behaviour
depending on the current directory during startup.  This also differs from
the expected behaviour of configuration directives, where relative paths
are expected to be resolved either from prefix or from configuration prefix.
Fix is to use ngx_conf_full_name() to resolve working_directory from prefix.
diffstat:
 src/core/nginx.c |  7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
diffs (17 lines):
diff --git a/src/core/nginx.c b/src/core/nginx.c
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -1281,6 +1281,13 @@ ngx_core_module_init_conf(ngx_cycle_t *c
 
 #endif
 
+
+    if (ccf->working_directory.len) {
+        if (ngx_conf_full_name(cycle, &ccf->working_directory, 0) != NGX_OK) {
+            return NGX_CONF_ERROR;
+        }
+    }
+
     return NGX_CONF_OK;
 }
 
    
    
More information about the nginx-devel
mailing list