【发布时间】:2022-12-23 14:19:38
【问题描述】:
根据我读过的内容,看起来我应该能够在运行 nginx reload 时指定一个新的配置文件路径:
sudo nginx -c ${config_file_path} -s reload
但我发现的是,config 参数只会将配置设置为在最初启动 nginx 时加载。所以如果我开始 nginx 使用...
sudo nginx -c /path/to/first/config/nginx.conf
然后我创建了一个不同的路径 /path/to/second/config/nginx.conf 并尝试运行...
sudo nginx -c /path/to/second/config/nginx.conf -s reload
第二个配置未加载。在我的 logs/errors.log 中,我看到 [notice] PID/PID: signal process started,但重新加载的内容实际上是对 /path/to/first/config/nginx.conf 的更改,即使我在重新加载中指定了第二个配置称呼。
这是预期的行为吗?即启动 nginx 时的 -c 参数将设置要使用的配置值,直到 nginx 停止,该参数真的对后续的重新加载调用没有影响吗?
对于它的价值,这是我的 nginx 版本信息:
nginx version: openresty/1.19.9.1
built by gcc 7.3.1 20180712 (Red Hat 7.3.1-13) (GCC)
built with OpenSSL 1.1.1k 25 Mar 2021 (running with OpenSSL 1.1.1l 24 Aug 2021)
TLS SNI support enabled
arguments:
--prefix=/usr/local/openresty/nginx
--with-cc-opt='-O2
-DNGX_LUA_ABORT_AT_PANIC
-I/usr/local/openresty/zlib/include
-I/usr/local/openresty/pcre/include
-I/usr/local/openresty/openssl111/include'
--add-module=../ngx_devel_kit-0.3.1
--add-module=../echo-nginx-module-0.62
--add-module=../xss-nginx-module-0.06
--add-module=../ngx_coolkit-0.2
--add-module=../set-misc-nginx-module-0.32
--add-module=../form-input-nginx-module-0.12
--add-module=../encrypted-session-nginx-module-0.08
--add-module=../srcache-nginx-module-0.32
--add-module=../ngx_lua-0.10.20
--add-module=../ngx_lua_upstream-0.07
--add-module=../headers-more-nginx-module-0.33
--add-module=../array-var-nginx-module-0.05
--add-module=../memc-nginx-module-0.19
--add-module=../redis2-nginx-module-0.15
--add-module=../redis-nginx-module-0.3.7
--add-module=../ngx_stream_lua-0.0.10
--with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib
-L/usr/local/openresty/zlib/lib
-L/usr/local/openresty/pcre/lib
-L/usr/local/openresty/openssl111/lib
-Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib'
--with-cc='ccache
gcc
-fdiagnostics-color=always'
--with-pcre-jit
--with-stream
--with-stream_ssl_module
--with-stream_ssl_preread_module
--with-http_v2_module
--without-mail_pop3_module
--without-mail_imap_module
--without-mail_smtp_module
--with-http_stub_status_module
--with-http_realip_module
--with-http_addition_module
--with-http_auth_request_module
--with-http_secure_link_module
--with-http_random_index_module
--with-http_gzip_static_module
--with-http_sub_module
--with-http_dav_module
--with-http_flv_module
--with-http_mp4_module
--with-http_gunzip_module
--with-threads
--with-compat
--with-stream
--with-http_ssl_module
【问题讨论】:
标签: nginx nginx-config