Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
1.7 kB
5
Indexable
Never
server {
        listen       80;
        listen       [::]:80;
        server_name  foo-bar;
        root         /usr/share/nginx/html;
        set $bucket "my-bucket.s3-my-region.amazonaws.com";
        set $subdomain $1;
        location / {
                resolver 10.x.x.2; #aws dns
                rewrite /$ "/$subdomain${uri}index.html" break;
                rewrite ^ /$subdomain$request_uri? break;
                proxy_http_version     1.1;
                proxy_redirect off;
                proxy_set_header       Connection "";
                proxy_set_header       Authorization '';
                proxy_set_header       Host $bucket;
                proxy_set_header       X-Real-IP $remote_addr;
                proxy_set_header       X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_hide_header      x-amz-id-2;
                proxy_hide_header      x-amz-request-id;
                proxy_hide_header      x-amz-meta-server-side-encryption;
                proxy_hide_header      x-amz-server-side-encryption;
                proxy_hide_header      Set-Cookie;
                proxy_ignore_headers   Set-Cookie;
                proxy_intercept_errors on;
                add_header             Cache-Control max-age=31536000;
                proxy_pass             http://$bucket;
        }

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        error_page 404 /404.html;
        location = /404.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }