gpt4 book ai didi

dns - 虚拟主机上的nginx子域配置

转载 作者:行者123 更新时间:2023-12-04 10:53:58 24 4
gpt4 key购买 nike

关于 nginx 子域配置,SO 上有几个问题,但没有找到与我的完全相同的问题。

假设我有一个虚拟主机 some.example.com来自更高级别的网络管理员 example.com在我们的组织。我想用some.example.com作为我的主要站点并使用 foo.some.example.combar.some.example.com用于辅助用途(代理等)。我尝试了这个简单的配置并将其放在 sites-enabled 下但没有用:

server {
listen 80;
server_name some.example.com;
root /home/me/public_html/some;
index index.html index.htm;
}

server {
listen 80;
server_name foo.some.example.com;
root /home/me/public_html/foo;
index index.html index.htm;
}

server {
listen 80;
server_name bar.some.example.com;
root /home/me/public_html/bar;
index index.html index.htm;
}

在此设置中 some.example.com工作正常,但对于其他两个浏览器返回 could not find foo.some.example.com .我在 ubuntu 服务器上运行它。

这个配置有问题吗?或者我应该和更高级别的网络管理员谈谈(让 foo.some.example.combar.some.example.com 注册)?

最佳答案

子域配置从父域的 DNS 服务器中的条目开始,查找将子域解析为 Web 服务器的 IP 地址。 Web 服务器依次根据其子域的配置委派请求。

如果您的子域中没有 DNS 设置,则 example.com 的管理员需要设置 CNAME 别名。别名将子域指向同一 Web 服务器,该服务器托管父域的网站。为每个子域添加规范名称 (CNAMES)。一旦子域解析为 Web 服务器的 IP 地址,Web 服务器就可以将请求路由到不同的网站。

关于dns - 虚拟主机上的nginx子域配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14249060/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com