NGINX 未跟踪位置

NGINX 未跟踪位置
server {


listen 80;
    server_name *.bitmitigate.com bitmitigate.com;

    location /.well-known/acme-challenge {
        proxy_pass 
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
  }
  location / {
    return 302 https://bitmitigate.com;
  }
}

本质上,如果它与该位置不匹配,我希望它返回 302,但由于某种原因,它不起作用并且总是返回 302

答案1

简单修复

server {
  listen 80;
  server_name *.bitmitigate.com bitmitigate.com;

  location ~ /.well-known/acme-challenge {
    proxy_pass 
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
  location / {
    return 302 https://bitmitigate.com;
  }
}

相关内容