nginx 配置文件的更改对于 reload 只在启动时生效吗?
2021-12-31 21:34:40
收藏:0
阅读:258
评论:1
根据我读到的,看起来我应该能在运行 nginx reload 时指定新的配置文件路径:
sudo nginx -c ${config_file_path} -s reload
但我发现配置参数只在最初启动 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
第二个配置文件没有被加载。在日志/错误.log 中我看到 [notice] PID/PID: signal process started,但实际上重新加载的是 /path/to/first/config/nginx.conf 的更改,尽管我在 reload 中指定了第二个配置文件。
这是预期的行为吗?也就是说,启动 nginx 时的 -c 参数将设置要使用的配置值,直到停止 nginx,并且该参数对于后续 reload 调用实际上没有影响?
值得一提的是,这是我的 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
原文链接 https://stackoverflow.com/questions/70545784
点赞
评论区的留言会收到邮件通知哦~
推荐文章
- 如何在roblox studio中1:1导入真实世界的地形?
- 求解,lua_resume的第二次调用继续执行协程问题。
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?
- addEventListener 返回 nil Lua
- Lua中获取用户配置主目录的跨平台方法
- 如何编写 Lua 模式将字符串(嵌套数组)转换为真正的数组?
将路径注入到
nginx -c
的配置文件主要是为了让临时nginx进程知道在哪里读取pid文件(在配置文件中是pid
指令),而不是为了重新加载守护进程nginx的配置。