server {
        listen          *:443 spdy ssl;
        listen          [::]:443 spdy ssl;
        server_name     sandbox.yandex-team.ru sandbox-dev.yandex-team.ru;
        access_log      /var/log/nginx/sandbox_access.log stat;
        error_log       /var/log/nginx/sandbox_error.log error;
        
        ssl on;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_ciphers kEECDH+AESGCM+AES128:kEECDH+AES128:kRSA+AESGCM+AES128:kRSA+AES128:DES-CBC3-SHA:!RC4:!aNULL:!eNULL:!MD5:!EXPORT:!LOW:!SEED:!CAMELLIA:!IDEA:!PSK:!SRP:!SSLv2;
        ssl_certificate     /etc/certs/sandbox.yandex-team.ru.pem;
        ssl_certificate_key /etc/certs/sandbox.yandex-team.ru.pem;

        ssl_session_cache   shared:SSL:128m;
        ssl_session_timeout 12h;
        
        gzip on;
        gzip_min_length 10240;

        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Scheme $scheme;
        
        error_page 405 = @405;
            location @405 {
            proxy_pass      http://127.0.0.1:9998;
        }
        
        location = /nginx_status {
            stub_status     on;
            access_log      off;
            allow           127.0.0.1;
            deny            all;
        }
        
        location ~ ^/media/ {
            add_header Cache-Control "max-age=7200";
            access_log off;
            root /home/zomb-sandbox/server/sandbox/web;
        }
        
        location ~ ^/docs/ {
            add_header Cache-Control "max-age=7200";
            access_log off;
            root /home/zomb-sandbox/;
        }
        
        location ~ ^/sandbox/resources/proxy(.*)$ {
            error_page 502 504 = @sandbox_backend;
            proxy_pass  http://127.0.0.1:9998;
            rewrite ^/sandbox/resources/proxy(.*)$ /sandbox/resources/redirect$1 break;
            proxy_redirect ~^http://(.*)$ http://proxy.sandbox.yandex-team.ru/$1;
        }
        
        location ~ ^/sandbox {
            error_page 502 504 = @sandbox_backend;
            proxy_pass  http://127.0.0.1:9998;
        }
        
        location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ {
            #access_log off;
            root /home/zomb-sandbox/ui;
        }
        
        location /assets/ {
            add_header Cache-Control "max-age=7200";
            try_files $uri =404;
            root /home/zomb-sandbox/ui;
        }
        
        location /static/footer/ {
            proxy_pass http://127.0.0.1:9998;
        }
        
        location /api/ {
            error_page 502 504 = @sandbox_backend;
            proxy_pass http://127.0.0.1:9998;
        }
        
        location @sandbox_backend {
            proxy_pass      http://sandbox_backend;
        }
        
        location / {
            try_files $uri /index.html;
            root /home/zomb-sandbox/ui;
        }
}
