| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| server_names_hash_bucket_size 128; |
| |
| # Sendfile copies data between one FD and other from within the kernel. |
| # More efficient than read() + write(), since the requires transferring data to and from the user space. |
| sendfile on; |
| |
| # Tcp_nopush causes nginx to attempt to send its HTTP response head in one packet, |
| # instead of using partial frames. This is useful for prepending headers before calling sendfile, |
| # or for throughput optimization. |
| tcp_nopush on; |
| |
| # Caches information about open FDs, freqently accessed files. |
| open_file_cache max=200000 inactive=20s; |
| open_file_cache_valid 30s; |
| open_file_cache_min_uses 2; |
| open_file_cache_errors on; |
| |
| # allow the server to close the connection after a client stops responding. Frees up socket-associated memory. |
| reset_timedout_connection on; |
| |
| #gzip on; |
| |
| |
| # be prepared to load any custom lua scripts from /etc/api-gateway/scripts |
| lua_package_path '/etc/api-gateway/scripts/lua/?.lua;;'; |
| init_worker_by_lua_file /etc/api-gateway/scripts/lua/api_gateway_init.lua; |
| |
| lua_shared_dict cachedkeys 50m; # caches api-keys |
| lua_shared_dict cachedOauthTokens 50m; # caches OAuth tokens |
| lua_shared_dict cachedUserProfiles 50m; # caches user profiles |
| lua_shared_dict healthcheck_redis 1m; # used by lua health_check for redis cache |