|
| 1 | +upstream api { |
| 2 | + server api:5000; |
| 3 | +} |
| 4 | + |
| 5 | +server { |
| 6 | + listen 80; |
| 7 | + listen [::]:80; |
| 8 | + listen 443 default ssl; |
| 9 | + server_name dat; |
| 10 | + |
| 11 | + ssl_certificate /etc/nginx/ssl/nginx.crt; |
| 12 | + ssl_certificate_key /etc/nginx/ssl/nginx.key; |
| 13 | + |
| 14 | + if ($scheme = http) { |
| 15 | + return 301 https://$host$http_x_script_name; |
| 16 | + } |
| 17 | + |
| 18 | + set $maintenance "off"; |
| 19 | + if ($maintenance = "on") { |
| 20 | + return 503; |
| 21 | + } |
| 22 | + |
| 23 | + set $env_host $host; |
| 24 | + if ($host = "localhost") { |
| 25 | + set $env_host "integration.nsidc.org"; |
| 26 | + } |
| 27 | + |
| 28 | + # index index.html index.htm index.php; |
| 29 | + |
| 30 | + access_log /var/log/nginx/dat.access.log combined; |
| 31 | + error_log /var/log/nginx/dat.error.log debug; |
| 32 | + |
| 33 | + sendfile off; |
| 34 | + |
| 35 | + location "/" { |
| 36 | + proxy_pass https://api; |
| 37 | + proxy_read_timeout 90; |
| 38 | + proxy_connect_timeout 90; |
| 39 | + proxy_redirect off; |
| 40 | + client_max_body_size 500M; |
| 41 | + |
| 42 | + proxy_set_header Host $host; |
| 43 | + proxy_set_header X-Real-IP $remote_addr; |
| 44 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 45 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 46 | + proxy_set_header X-Script-Name $http_x_script_name; |
| 47 | + } |
| 48 | + |
| 49 | + # TODO: remove when OBE. This allows exposing a pre-release of the EDD with |
| 50 | + # the trusted sources json file updated. Once |
| 51 | + # https://github.com/nasa/earthdata-download/pull/56 is merged, this can go |
| 52 | + # away. |
| 53 | + location "/earthdata-download-release" { |
| 54 | + alias /var/www/edd_release/; |
| 55 | + autoindex on; # Enables directory listing |
| 56 | + autoindex_exact_size off; # Show file sizes in a human-readable format |
| 57 | + } |
| 58 | +} |
0 commit comments