nginx Windows:设置站点可用配置 [英] nginx Windows: setting up sites-available configs

查看:24
本文介绍了nginx Windows:设置站点可用配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的 Windows 开发环境中设置 Nginx.我找不到如何在 Linux 上创建类似于 "sites-enabled" 的东西,Nginx 将在其中查找(链接到)活动的虚拟主机配置.

I'm trying to set up Nginx on my Windows development environment. I can't find how to create something similar to "sites-enabled" on Linux where Nginx would look for (links to) active virtual host configurations.

有没有办法对带有实际配置文件快捷方式的目录和 Nginx 扫描该目录的目录做类似的事情?或者除了将主机配置复制到 nginx.conf 之外,还有其他方法可以连接虚拟主机配置吗?

Is there a way to do something similar with a directory with shortcuts to the actual configuration files and Nginx scanning that directory? Or is there another way to hook up a virtual host configuration other than copying the host configuration to nginx.conf?

推荐答案

一些 nginx 的 Linux 包使用的启用站点"的方法利用了 include 指令,它理解 shell 通配符,参见 http://nginx.org/r/include.您也可以在自己的配置中使用它,例如

The "sites-enabled" approach as used by some Linux packages of nginx utilize include directive, which understands shell wildcards, see http://nginx.org/r/include. You may use it in your own config as well, e.g.

http {
    ...
    include /path/to/sites/*.conf;
}

请注意,尽管这种方法可能非常令人困惑(特别是,除非您明确使用 default_server,否则很难判断哪个服务器{}是默认服务器).

Note though that such approach might be very confusing (in particular, it would be hard to tell which server{} is the default one unless you use default_server explicitly).

这篇关于nginx Windows:设置站点可用配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆