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

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

问题描述

我正在尝试在Windows开发环境中设置Nginx.我找不到如何在Linux上创建类似于"sites-enabled"的内容的方法,在Linux上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指令,该指令可以理解外壳通配符,请参见

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天全站免登陆