| # 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. |
| |
| # This nginx.conf is designed and written for local dev environments |
| # It will use the blocking startup mode and console logging |
| worker_processes 1; |
| daemon off; |
| error_log /dev/stdout debug; |
| |
| events { |
| worker_connections 1024; |
| } |
| http { |
| lua_package_path "/usr/local/share/lua/5.1/skywalking/?.lua;;"; |
| # Buffer represents the register inform and the queue of the finished segment |
| lua_shared_dict tracing_buffer 100m; |
| |
| # Init is the timer setter and keeper |
| # Setup an infinite loop timer to do register and trace report. |
| init_worker_by_lua_block { |
| local metadata_buffer = ngx.shared.tracing_buffer |
| |
| metadata_buffer:set("serviceName", "skywalking-nginx") |
| -- Instance means the number of Nginx deployment, does not mean the worker instances |
| metadata_buffer:set("serviceInstanceName", "e2e") |
| -- set ignoreSuffix |
| require("skywalking.util").set_ignore_suffix(".jpg,.jpeg,.js,.css,.png,.bmp,.gif,.ico,.mp3,.mp4,.svg") |
| |
| require("skywalking.util").set_randomseed() |
| require("skywalking.client"):startBackendTimer("http://172.16.238.10:12800") |
| |
| -- If there is a bug of this `tablepool` implementation, we can |
| -- disable it in this way |
| -- require("skywalking.util").disable_tablepool() |
| |
| skywalking_tracer = require("skywalking.tracer") |
| } |
| |
| server { |
| listen 8080; |
| |
| location /info { |
| default_type text/html; |
| rewrite_by_lua_block { |
| skywalking_tracer:start("e2e-test-with-mock-collector:upstream_ip:port") |
| } |
| |
| proxy_pass http://provider:9090; |
| |
| body_filter_by_lua_block { |
| skywalking_tracer:finish() |
| } |
| |
| log_by_lua_block { |
| skywalking_tracer:prepareForReport() |
| } |
| } |
| |
| location /suffix { |
| default_type text/html; |
| content_by_lua_block { |
| ngx.say("<p>Suffix for testing only.</p>") |
| } |
| |
| rewrite_by_lua_block { |
| skywalking_tracer:start("e2e-test-with-mock-collector:upstream_ip:port") |
| } |
| |
| body_filter_by_lua_block { |
| skywalking_tracer:finish() |
| } |
| |
| log_by_lua_block { |
| skywalking_tracer:prepareForReport() |
| } |
| } |
| } |
| } |