Openresty:如何使用不同的nginx.conf?

在 Ubuntu 20.04 中: 我已经安装了 openresty 并且运行良好。 它使用默认的 /usr/local/openresty/nginx/conf/nginx.conf

我想要使用一个新的自定义 nginx.conf 文件,它位于 ~/conf/nginx.conf 中。

我应该怎样让 openresty 运行这个新的配置文件?

原文链接 https://stackoverflow.com/questions/69166239

点赞
stackoverflow用户3703783
stackoverflow用户3703783

刚刚找到了答案:

ubuntu@john:~$ openresty -help
nginx 版本:openresty/1.19.9.1
Usage: nginx [-?hvVtTq] [-s signal] [-p prefix]
             [-e filename] [-c filename] [-g directives]

Options:
  -?,-h         : 显示帮助信息
  -v            : 显示版本信息并退出
  -V            : 显示版本信息和配置选项然后退出
  -t            : 测试配置且退出
  -T            : 测试配置,打印配置并退出
  -q            : 在测试配置过程中抑制非错误消息
  -s signal     : 向主进程发送信号:stop,quit,reopen,reload
  -p prefix     : 设置前缀路径(默认值:/usr/local/openresty/nginx/)
  -e filename   : 设置错误日志文件(默认值:logs/error.log)
  -c filename   : 设置配置文件(默认值:conf/nginx.conf)
  -g directives : 在配置文件之外设置全局指令

使用

openresty -c filename
2021-09-13 16:40:57