2

我想从 NGINX 打印 request_body 和 response_body。

我尝试实施一些我从这里学到的解决方案

但在我的情况下它不起作用。我需要在我的NGINX.conf文件中配置一些其他更改吗?

这是我的conf文件。

worker_processes 4;

events { worker_connections 1024; }

http {

    sendfile on;

    upstream consumer-portal {
        server xx.xx.xx.xx:9006;
    }
     upstream download-zip-service {
        server xx.xx.xx.xx:9012;
    }
server {
        listen 8765;

        location / {
            proxy_pass         http://download-zip-service/;
            proxy_redirect     off;
            # 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-Host $server_name;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            #socket timeout setting added
            fastcgi_read_timeout 7200s; 
            send_timeout 7200s;
            proxy_connect_timeout 7200s;
            proxy_send_timeout 7200s;
            proxy_read_timeout 7200s;
            #new property added
            proxy_request_buffering off;
            proxy_buffering off;
        }
        location /consumer-portal/ {
            proxy_pass         http://consumer-portal/;
            proxy_redirect     off;
            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-Host $server_name;
        }
    }
}

下面是 docker-compose.yml

version: '3'
services:
  nginx:
    restart: always
    build: ../../conf/sandbox/
    volumes:
    - ./mysite.template:/etc/nginx/conf.d/mysite.template
    ports:
    - "8765:8765"
    networks:
      - cloud


networks:
  cloud:
   driver: bridge

请让我知道我需要配置哪些更改。

提前致谢。

4

0 回答 0