Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
要实现以下服务器配置需要做什么?
abc.com、def.com、ghi.com 和所有其他指向此 IP -> 服务器块 A。
仅限specialdomain.com -> 服务器块 B。
我尝试创建两个服务器块,一个带有 server_name localhost 和默认监听 8080,另一个带有 server_name specialdomain.com 和监听 8080,但它将所有请求通过管道传输到第一个服务器块。
解决方案是为 设置一个特定的 nginx 配置块specialdomain.com,然后为其余部分设置一个通用的包罗万象的 nginx 配置块。
specialdomain.com
一个块应server_name设置为www.specialdomain.com specialdomain.com,另一个块应设置为localhost。
server_name
www.specialdomain.com specialdomain.com
localhost