Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silence NGINX in Docker Compose

How can I silence NGINX in the terminal window while using Docker-Compose? Every single call is being echoed to the console. It is so noisy that I cannot see the other console.log() messages from Node.

Here's my nginx.conf file...

worker_processes 4;

events { worker_connections 4096; }

http {

  ssl_session_cache     shared:SSL:10m;
  ssl_session_timeout   30m;

  proxy_temp_path       /var/tmp;
  include               mime.types;
  default_type          application/octet-stream;
  sendfile              on;

  upstream mycompany-api01 {
    server mycompany-api01:3000;
  }

    server {
      listen        80;
      server_name   api01.mycompany.com;
      root          /var/www/public;

      location / {
          proxy_pass            http://mycompany-api01;
          proxy_http_version    1.1;
          proxy_set_header      Upgrade $http_upgrade;
          proxy_set_header      Connection 'upgrade';
          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-NginX-Proxy    true;
          proxy_cache_bypass    $http_upgrade;
      }
    }
}
like image 330
G. Deward Avatar asked Oct 20 '25 07:10

G. Deward


2 Answers

You can use access_log off; to only disable the access log and leave the error log on.

Or if you only don't want to see the logs you can use docker-compose logs -f node to only see the logs of node.

like image 116
Julian Avatar answered Oct 21 '25 22:10

Julian


You can use logging

logging:
    driver: none
like image 37
vegiops Avatar answered Oct 21 '25 22:10

vegiops



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!