2019-04-10 11:08:25 +08:00
|
|
|
master_process on;
|
|
|
|
|
|
|
|
worker_processes 1;
|
|
|
|
|
|
|
|
error_log logs/error.log warn;
|
|
|
|
pid logs/nginx.pid;
|
|
|
|
|
|
|
|
worker_rlimit_nofile 20480;
|
|
|
|
|
|
|
|
events {
|
|
|
|
accept_mutex off;
|
|
|
|
worker_connections 10620;
|
|
|
|
}
|
|
|
|
|
2019-06-14 16:11:14 +08:00
|
|
|
worker_rlimit_core 500M;
|
2019-06-21 16:13:19 +08:00
|
|
|
working_directory /tmp/apisix_cores/;
|
2019-06-14 16:11:14 +08:00
|
|
|
|
2019-06-11 07:41:49 +08:00
|
|
|
worker_shutdown_timeout 3;
|
2019-04-10 11:08:25 +08:00
|
|
|
|
|
|
|
http {
|
2019-06-15 23:22:29 +08:00
|
|
|
lua_package_path "$prefix/deps/share/lua/5.1/?.lua;$prefix/lua/?.lua;/usr/share/lua/5.1/?.lua;;";
|
2019-06-16 07:46:17 +08:00
|
|
|
lua_package_cpath "$prefix/deps/lib64/lua/5.1/?.so;$prefix/deps/lib/lua/5.1/?.so;/usr/lib64/lua/5.1/?.so;;";
|
2019-04-10 11:08:25 +08:00
|
|
|
|
2019-07-17 23:52:15 +08:00
|
|
|
lua_shared_dict plugin-limit-req 10m;
|
|
|
|
lua_shared_dict plugin-limit-count 10m;
|
|
|
|
lua_shared_dict prometheus-metrics 10m;
|
|
|
|
lua_shared_dict plugin-limit-conn 10m;
|
2019-07-21 09:08:06 +08:00
|
|
|
lua_shared_dict upstream-healthcheck 10m;
|
2019-07-17 23:52:15 +08:00
|
|
|
lua_shared_dict worker-events 10m;
|
2019-05-20 16:50:43 +08:00
|
|
|
|
2019-04-10 11:08:25 +08:00
|
|
|
lua_ssl_verify_depth 5;
|
|
|
|
ssl_session_timeout 86400;
|
|
|
|
|
|
|
|
lua_socket_log_errors off;
|
|
|
|
|
|
|
|
resolver ipv6=off local=on;
|
|
|
|
resolver_timeout 5;
|
|
|
|
|
|
|
|
lua_http10_buffering off;
|
|
|
|
|
2019-07-17 23:52:15 +08:00
|
|
|
lua_regex_match_limit 100000;
|
|
|
|
lua_regex_cache_max_entries 8192;
|
|
|
|
|
2019-04-10 11:08:25 +08:00
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] $http_host "$request" $status $body_bytes_sent $request_time "$http_referer" "$http_user_agent" $upstream_addr $upstream_status $upstream_response_time';
|
|
|
|
|
|
|
|
access_log logs/access.log main buffer=32768 flush=3;
|
|
|
|
open_file_cache max=1000 inactive=60;
|
|
|
|
client_max_body_size 0;
|
|
|
|
|
|
|
|
server_tokens off;
|
2019-05-28 10:19:34 +08:00
|
|
|
more_set_headers 'Server: APISIX web server';
|
2019-04-10 11:08:25 +08:00
|
|
|
|
2019-07-31 12:16:51 +08:00
|
|
|
include mime.types;
|
|
|
|
|
2019-07-15 08:24:35 +08:00
|
|
|
real_ip_header X-Real-IP;
|
|
|
|
set_real_ip_from 127.0.0.1;
|
|
|
|
set_real_ip_from unix:;
|
|
|
|
|
2019-06-14 10:27:45 +08:00
|
|
|
upstream apisix_backend {
|
2019-05-17 15:58:15 +08:00
|
|
|
server 0.0.0.1;
|
|
|
|
balancer_by_lua_block {
|
2019-07-01 17:24:38 +08:00
|
|
|
apisix.http_balancer_phase()
|
2019-05-17 15:58:15 +08:00
|
|
|
}
|
2019-05-29 10:31:20 +08:00
|
|
|
|
|
|
|
keepalive 32;
|
2019-05-17 15:58:15 +08:00
|
|
|
}
|
|
|
|
|
2019-04-10 11:08:25 +08:00
|
|
|
init_by_lua_block {
|
2019-05-08 10:38:45 +08:00
|
|
|
require "resty.core"
|
2019-05-13 14:28:54 +08:00
|
|
|
apisix = require("apisix")
|
2019-07-01 17:24:38 +08:00
|
|
|
apisix.http_init()
|
2019-04-10 11:08:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
init_worker_by_lua_block {
|
2019-07-01 17:24:38 +08:00
|
|
|
apisix.http_init_worker()
|
2019-04-10 11:08:25 +08:00
|
|
|
}
|
|
|
|
|
2019-07-15 08:24:35 +08:00
|
|
|
|
2019-04-10 11:08:25 +08:00
|
|
|
server {
|
2019-07-15 08:24:35 +08:00
|
|
|
listen 9080;
|
2019-06-22 10:44:07 +08:00
|
|
|
listen 9443 ssl;
|
|
|
|
ssl_certificate cert/apisix.crt;
|
|
|
|
ssl_certificate_key cert/apisix.key;
|
|
|
|
ssl_session_cache shared:SSL:1m;
|
|
|
|
|
2019-06-13 12:01:36 +08:00
|
|
|
location = /apisix/nginx_status {
|
2019-06-22 08:24:02 +08:00
|
|
|
allow 127.0.0.0/24;
|
2019-07-29 18:07:10 +08:00
|
|
|
deny all;
|
2019-05-31 15:21:51 +08:00
|
|
|
access_log off;
|
|
|
|
stub_status;
|
2019-06-13 12:01:36 +08:00
|
|
|
}
|
|
|
|
|
2019-08-12 09:04:41 +08:00
|
|
|
location /apisix/admin {
|
2019-06-13 12:01:36 +08:00
|
|
|
allow 127.0.0.0/24;
|
2019-07-29 18:07:10 +08:00
|
|
|
deny all;
|
2019-08-01 15:18:52 +08:00
|
|
|
|
2019-06-13 12:01:36 +08:00
|
|
|
content_by_lua_block {
|
2019-07-01 17:24:38 +08:00
|
|
|
apisix.http_admin()
|
2019-06-13 12:01:36 +08:00
|
|
|
}
|
2019-05-31 15:21:51 +08:00
|
|
|
}
|
2019-06-22 10:44:07 +08:00
|
|
|
|
|
|
|
ssl_certificate_by_lua_block {
|
2019-07-01 17:24:38 +08:00
|
|
|
apisix.http_ssl_phase()
|
2019-06-22 10:44:07 +08:00
|
|
|
}
|
2019-05-31 15:21:51 +08:00
|
|
|
|
2019-08-09 15:09:07 +08:00
|
|
|
location /apisix/dashboard/ {
|
2019-08-01 15:18:52 +08:00
|
|
|
index index.html;
|
|
|
|
allow 127.0.0.0/24;
|
|
|
|
deny all;
|
|
|
|
|
2019-08-09 15:09:07 +08:00
|
|
|
alias dashboard/;
|
2019-08-01 15:18:52 +08:00
|
|
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Real-PORT $remote_port;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
|
|
try_files $uri $uri/ /index.html;
|
|
|
|
}
|
|
|
|
|
2019-04-10 11:08:25 +08:00
|
|
|
location / {
|
2019-05-17 15:58:15 +08:00
|
|
|
set $upstream_scheme 'http';
|
|
|
|
set $upstream_host $host;
|
|
|
|
set $upstream_upgrade '';
|
|
|
|
set $upstream_connection '';
|
|
|
|
set $upstream_uri '';
|
|
|
|
|
2019-04-10 11:08:25 +08:00
|
|
|
access_by_lua_block {
|
2019-07-01 17:24:38 +08:00
|
|
|
apisix.http_access_phase()
|
2019-04-10 11:08:25 +08:00
|
|
|
}
|
|
|
|
|
2019-05-17 15:58:15 +08:00
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Host $upstream_host;
|
|
|
|
proxy_set_header Upgrade $upstream_upgrade;
|
|
|
|
proxy_set_header Connection $upstream_connection;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_pass_header Server;
|
|
|
|
proxy_pass_header Date;
|
2019-06-14 10:27:45 +08:00
|
|
|
proxy_pass $upstream_scheme://apisix_backend$upstream_uri;
|
2019-05-17 15:58:15 +08:00
|
|
|
|
2019-04-10 11:08:25 +08:00
|
|
|
header_filter_by_lua_block {
|
2019-07-01 17:24:38 +08:00
|
|
|
apisix.http_header_filter_phase()
|
2019-04-10 11:08:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
log_by_lua_block {
|
2019-07-01 17:24:38 +08:00
|
|
|
apisix.http_log_phase()
|
2019-04-10 11:08:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|