【问题标题】:Setting up an nginx configuration to have all domains go to one server block, except one设置 nginx 配置以使所有域都转到一个服务器块,除了一个
【发布时间】:2011-06-20 15:06:40
【问题描述】:

要实现以下服务器配置需要做什么?

abc.com、def.com、ghi.com 和所有其他都指向此 IP -> 服务器块 A。

specialdomain.com only -> 服务器块 B.

我尝试创建两个服务器块,一个带有 server_name localhost 且默认侦听 8080,另一个带有 server_name specialdomain.com 并带有侦听 8080,但它将所有请求通过管道传输到第一个服务器块。

【问题讨论】:

    标签: nginx hosts


    【解决方案1】:

    解决方案是为specialdomain.com 设置一个特定的 nginx 配置块,然后为其余部分设置一个通用的包罗万象的 nginx 配置块。

    一个块应将server_name 设置为www.specialdomain.com specialdomain.com,另一个块应将其设置为localhost

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-23
      • 1970-01-01
      • 1970-01-01
      • 2018-02-10
      • 1970-01-01
      • 1970-01-01
      • 2018-03-27
      • 2015-04-17
      相关资源
      最近更新 更多