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.
This commit is contained in:
FengGu 2025-12-18 11:17:38 +08:00
parent 0609736a92
commit c3e44c8c12

View file

@ -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;
}
}