duanfei7508 2015-10-02 18:04
浏览 185

Docker nginx和Go(Golang)是独立的容器。 Nginx配置

On my localhost I've got Docker with 2 containers: Nginx and Golang. I want to do request from my local machine and get response from Go (localhost -> Nginx -> Go).

Containers work. I can go into Nginx container and run curl -v 'test:8080/path' -d "param1=value1&param2=value2" and I've got correct response.

But If I try to run the same request from host machine I've got an error - 502 Bad Gateway. If I change request and run curl -v -X POST 'test:8080/path' (same request without data) - It's ok.

My Nginx config:

server {
    listen 80;
    server_name test;

    client_max_body_size 20M;

    charset utf8;

    location / {
        proxy_pass http://go:8000;  // there go - docker compose link
    }
}

I think, problem in Nginx configuration. But I'm newbie with nginx. Plz, help me :)

  • 写回答

1条回答 默认 最新

  • dongyangzhi0687 2015-10-02 19:05
    关注

    My fault, guys. My Go program returns nothing. So nginx interpreted empty response as bad request and return 502.

    评论

报告相同问题?

悬赏问题

  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试