11

不懂就问,有关 nginx 和 hosts 的问题

 2 years ago
source link: https://www.v2ex.com/t/779409
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  NGINX

不懂就问,有关 nginx 和 hosts 的问题

  Huozy · 28 分钟前 · 66 次点击

nginx 配置如下

server {
      listen       9005;
      server_name  192.168.1.1;
      location /135app/ {
          proxy_pass http://test135:8060;
      }
      location /246app/ {
          proxy_pass http://test246:8060;
      }
}

hosts 配置如下

10.10.1.2	test135
10.10.1.3	test135
10.10.2.5	test246

问题 1:10.10.1.2 失效不通的时候,nginx 是否会自动请求到 10.10.1.3 ? 不会的话,怎么配置 nginx 可以做到动态的解析域名?

问题 2:我实质是想通过域名和 DNS 去访问,若问题 1 无法解决的话,我在 resolv.conf 中添加 dns 地址后,nginx 配置需要做更改吗?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK