编译 Nginx 时保持站点可用/启用结构

Max*_*Max 1 ubuntu configuration nginx

我使用nginxubuntu的默认情况下有sites-available/enabled类似的目录结构Apache来存储站点配置文件。我已经nginx使用以下配置编译(因为我需要第三方模块):

./configure \
    --prefix=/opt/nginx/version \
    --http-log-path=/var/log/nginx/access.log \
    --error-log-path=/var/log/nginx/error.log \
    --pid-path=/var/run/nginx.pid \
    --with-http_ssl_module \
    --user=nginx \
    --group=nginx \
    --add-module=...
Run Code Online (Sandbox Code Playgroud)

Nginx 工作正常,但现在我需要配置我的所有站点,/opt/nginx/version/conf/nginx.conf其中不像sites-available/enabled目录结构那样可维护,我可以为每个站点创建 1 个文件并决定哪些站点启用了符号链接。

我查看了安装选项,但我看到的只是--conf-path指定nginx.conf.

有没有办法在sites-available/enabled编译后的 nginx 中重用目录结构?

and*_*dol 6

如果您查看默认的 Ubuntu /etc/nginx/nginx.conf,您应该会找到以下行。

http {
    ...
    include /etc/nginx/sites-enabled/*;
}
Run Code Online (Sandbox Code Playgroud)

这就是让启用站点的魔法发生所需要的。