node_exporter_nginx.j2 778 B

1234567891011121314151617181920212223242526
  1. server {
  2. listen 443 ssl http2;
  3. listen [::]:443 ssl http2;
  4. server_name {{ ansible_fqdn }};
  5. include /etc/nginx/ssl.conf;
  6. ssl_certificate /var/lib/acme/live/{{ ansible_fqdn }}/fullchain;
  7. ssl_certificate_key /var/lib/acme/live/{{ ansible_fqdn }}/privkey;
  8. access_log off;
  9. location /metrics {
  10. if ($http_authorization != 'Bearer {{ node_exporter_authorization_token }}') {
  11. return 403;
  12. }
  13. proxy_http_version 1.1;
  14. proxy_set_header Host $host;
  15. proxy_set_header X-Real-IP $remote_addr;
  16. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  17. proxy_set_header X-Forwarded-Proto $scheme;
  18. proxy_pass http://localhost:9100;
  19. proxy_redirect off;
  20. }
  21. }