ngnix代理转发报502

这是我的nginx
access.log下看/resources转发都是200
就下面的/v2/请求是502这是怎么回事?

clipboard.png

server {
   listen   80;
   server_name  test.com;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass   http://localhost:8080;
    }

    location /resources {
        proxy_pass http://localhost:8080/resources;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
    }

    location ^~ /v2/ {
        proxy_store off;
        proxy_redirect off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_connect_timeout 600;
        proxy_read_timeout 600;
        proxy_send_timeout 600;
        proxy_set_header Host "test.com";
        proxy_pass https://api.douban.com/;
    }

}
阅读 2.7k
1 个回答

可以看下Nginx的相关日志

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏