[PATCH 2 of 5] Core: fixed working_directory to be resolved from prefix
    Maxim Dounin 
    mdounin at mdounin.ru
       
    Fri Oct 24 01:42:38 UTC 2025
    
    
  
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1761147230 -10800
#      Wed Oct 22 18:33:50 2025 +0300
# Node ID df1f91eafba30d5ed1c9ad80d771be043d731e9a
# Parent  150ed2787334acba57012565d6fc81e314a2f064
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.
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