小编Y T*_*sky的帖子

Nginx 缓存 DNS 查找并忽略我的解析器设置

我正在使用码头群。我在 API 前面放置了一个 nginx 容器以进行缓存。由于每次部署 API 时,它都会创建一个新的内部 IP,因此我根据 swarm 文档使用我的服务tasks.api 的名称。下面是我的位置块

proxy_cache_path /var/cache/nginx/ta_api levels=1:2 keys_zone=api_cache:10m max_size=10g
                  inactive=60m use_temp_path=off;

server {
    listen       80;
    server_name  localhost;

    location / {
      proxy_pass http://tasks.api:10010;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection 'upgrade';
      proxy_set_header Host $host;
      proxy_buffering on;
      proxy_cache api_cache;
      proxy_cache_bypass $http_upgrade;
      # Add header to see if response was cached
      add_header X-Cache-Status $upstream_cache_status;

      # Allow one cache-update request at a time sent to an origin server.
      proxy_cache_lock on;
      # Permit revalidation of stale cached responses. …
Run Code Online (Sandbox Code Playgroud)

dns nginx docker

7
推荐指数
1
解决办法
8344
查看次数

标签 统计

dns ×1

docker ×1

nginx ×1