server {
    listen 80;
    server_name stagingrabbitmq.spottorg.ru;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name stagingrabbitmq.spottorg.ru;

    access_log /var/log/nginx/stagingrabbitmq.spottorg.ru_access.log json;
    error_log /var/log/nginx/stagingrabbitmq.spottorg.ru_error.log;

    ssl_certificate /etc/nginx/ssl/spottorg.crt;
    ssl_certificate_key /etc/nginx/ssl/spottorg.key;

    proxy_buffer_size 128k;
    proxy_buffers 4 128k;
    client_body_buffer_size 32k;
    client_header_buffer_size 256k;
    large_client_header_buffers 4 256k;

    location / {
        client_max_body_size 600m;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://rabbitmq:15672;
        proxy_connect_timeout 600;
        proxy_send_timeout 600;
        proxy_read_timeout 600;
        send_timeout 600;
    }

    location /metrics {
        client_max_body_size 600m;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://rabbitmq:15692/metrics;
        proxy_connect_timeout 600;
        proxy_send_timeout 600;
        proxy_read_timeout 600;
        send_timeout 600;
    }
}
