|
| 1 | +# Auto-generated by start_esp |
| 2 | +# Copyright (C) Extensible Service Proxy Authors |
| 3 | +# All rights reserved. |
| 4 | +# |
| 5 | +# Redistribution and use in source and binary forms, with or without |
| 6 | +# modification, are permitted provided that the following conditions |
| 7 | +# are met: |
| 8 | +# 1. Redistributions of source code must retain the above copyright |
| 9 | +# notice, this list of conditions and the following disclaimer. |
| 10 | +# 2. Redistributions in binary form must reproduce the above copyright |
| 11 | +# notice, this list of conditions and the following disclaimer in the |
| 12 | +# documentation and/or other materials provided with the distribution. |
| 13 | +# |
| 14 | +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 15 | +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 | +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 17 | +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 18 | +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 19 | +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 20 | +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 21 | +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 22 | +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 23 | +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 24 | +# SUCH DAMAGE. |
| 25 | + |
| 26 | +daemon off; |
| 27 | + |
| 28 | +user nginx nginx; |
| 29 | + |
| 30 | +pid ./start_esp/test/pid_file; |
| 31 | + |
| 32 | +# Worker/connection processing limits |
| 33 | +worker_processes 1; |
| 34 | +worker_rlimit_nofile 10240; |
| 35 | +events { worker_connections 10240; } |
| 36 | + |
| 37 | +# Logging to stderr enables better integration with Docker and GKE/Kubernetes. |
| 38 | +error_log stderr warn; |
| 39 | + |
| 40 | +http { |
| 41 | + include /etc/nginx/mime.types; |
| 42 | + include /etc/nginx/conf/*.conf; |
| 43 | + server_tokens off; |
| 44 | + client_max_body_size 32m; |
| 45 | + client_body_buffer_size 128k; |
| 46 | + client_body_timeout 86600s; |
| 47 | + |
| 48 | + # HTTP subrequests |
| 49 | + endpoints_resolver 8.8.8.8; |
| 50 | + endpoints_certificates /etc/nginx/trusted-ca-certificates.crt; |
| 51 | + |
| 52 | + upstream app_server0 { |
| 53 | + server 127.0.0.1:8081; |
| 54 | + keepalive 128; |
| 55 | + } |
| 56 | + |
| 57 | + set_real_ip_from 0.0.0.0/0; |
| 58 | + set_real_ip_from 0::/0; |
| 59 | + real_ip_header X-Forwarded-For; |
| 60 | + real_ip_recursive on; |
| 61 | + |
| 62 | + |
| 63 | + server { |
| 64 | + server_name ""; |
| 65 | + resolver 8.8.8.8; |
| 66 | + |
| 67 | + |
| 68 | + listen 8080 backlog=16384; |
| 69 | + |
| 70 | + access_log /dev/stdout; |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + location / { |
| 76 | + # Begin Endpoints v2 Support |
| 77 | + endpoints { |
| 78 | + on; |
| 79 | + server_config /etc/nginx/server_config.pb.txt; |
| 80 | + google_authentication_secret key; |
| 81 | + metadata_server http://169.254.169.254; |
| 82 | + } |
| 83 | + # End Endpoints v2 Support |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + proxy_pass http://app_server0; |
| 88 | + proxy_redirect off; |
| 89 | + proxy_set_header Host $host; |
| 90 | + proxy_set_header X-Real-IP $remote_addr; |
| 91 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 92 | + proxy_set_header X-Forwarded-Host $server_name; |
| 93 | + proxy_set_header X-Google-Real-IP $remote_addr; |
| 94 | + |
| 95 | + # Enable the upstream persistent connection |
| 96 | + proxy_http_version 1.1; |
| 97 | + proxy_set_header Connection ""; |
| 98 | + |
| 99 | + # 86400 seconds (24 hours) is the maximum a server is allowed. |
| 100 | + proxy_send_timeout 86400s; |
| 101 | + proxy_read_timeout 86400s; |
| 102 | + } |
| 103 | + |
| 104 | + include /var/lib/nginx/extra/*.conf; |
| 105 | + } |
| 106 | + |
| 107 | + server { |
| 108 | + # expose /nginx_status and /endpoints_status but on a different port to |
| 109 | + # avoid external visibility / conflicts with the app. |
| 110 | + listen 8090; |
| 111 | + location /nginx_status { |
| 112 | + stub_status on; |
| 113 | + access_log off; |
| 114 | + } |
| 115 | + location /endpoints_status { |
| 116 | + endpoints_status; |
| 117 | + access_log off; |
| 118 | + } |
| 119 | + location /healthz { |
| 120 | + return 200; |
| 121 | + access_log off; |
| 122 | + } |
| 123 | + location / { |
| 124 | + root /dev/null; |
| 125 | + } |
| 126 | + } |
| 127 | +} |
0 commit comments