1. location /stats {
  2. proxy_pass http://127.0.0.1:8001;
  3. proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
  4. proxy_redirect off;
  5. proxy_buffering off;
  6. proxy_set_header Host $host;
  7. proxy_set_header X-Real-IP $remote_addr;
  8. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  9. access_log /var/log/nginx/piwik.access.log;
  10. error_log /var/log/nginx/piwik.error.log;
  11. }