|
| 1 | +server { |
| 2 | + listen 80; |
| 3 | + listen [::]:80; |
| 4 | + server_name localhost; |
| 5 | + |
| 6 | + #access_log /var/log/nginx/host.access.log main; |
| 7 | + |
| 8 | + location / { |
| 9 | + ssi on; |
| 10 | + set $dap_code_env '${DAP_ENV}'; |
| 11 | + set $dap_code_location 'Universal-Federated-Analytics-Min.js'; |
| 12 | + |
| 13 | + if ($dap_code_env = 'stg') { |
| 14 | + set $dap_code_location 'https://d3vtlq0ztv2u27.cloudfront.net/Universal-Federated-Analytics-Min.js'; |
| 15 | + } |
| 16 | + if ($dap_code_env = 'prd') { |
| 17 | + set $dap_code_location 'https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js'; |
| 18 | + } |
| 19 | + |
| 20 | + # Create the script tag to include in each page's header using the |
| 21 | + # dap_code_location which is defined above |
| 22 | + set $header_script_tag ' |
| 23 | + <script> |
| 24 | + (function() { |
| 25 | + const queryParams = new URLSearchParams(window.location.search); |
| 26 | + const dapScriptTag = document.createElement("script"); |
| 27 | + const dapCodeLocation = "" |
| 28 | + dapScriptTag.id = "_fed_an_ua_tag"; |
| 29 | + dapScriptTag.async = true; |
| 30 | + dapScriptTag.src = "${dap_code_location}" + "?dapdev=true&" + queryParams.toString(); |
| 31 | + document.head.appendChild(dapScriptTag); |
| 32 | + })(); |
| 33 | + </script> |
| 34 | + '; |
| 35 | + |
| 36 | + root /usr/share/nginx/html; |
| 37 | + index index.html index.htm; |
| 38 | + } |
| 39 | + |
| 40 | + #error_page 404 /404.html; |
| 41 | + |
| 42 | + # redirect server error pages to the static page /50x.html |
| 43 | + # |
| 44 | + error_page 500 502 503 504 /50x.html; |
| 45 | + location = /50x.html { |
| 46 | + root /usr/share/nginx/html; |
| 47 | + } |
| 48 | + |
| 49 | + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 |
| 50 | + # |
| 51 | + #location ~ \.php$ { |
| 52 | + # proxy_pass http://127.0.0.1; |
| 53 | + #} |
| 54 | + |
| 55 | + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 |
| 56 | + # |
| 57 | + #location ~ \.php$ { |
| 58 | + # root html; |
| 59 | + # fastcgi_pass 127.0.0.1:9000; |
| 60 | + # fastcgi_index index.php; |
| 61 | + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; |
| 62 | + # include fastcgi_params; |
| 63 | + #} |
| 64 | + |
| 65 | + # deny access to .htaccess files, if Apache's document root |
| 66 | + # concurs with nginx's one |
| 67 | + # |
| 68 | + #location ~ /\.ht { |
| 69 | + # deny all; |
| 70 | + #} |
| 71 | +} |
0 commit comments