mirror of
https://gitee.com/iresty/apisix.git
synced 2024-11-30 11:07:59 +08:00
111 lines
2.7 KiB
Nginx Configuration File
111 lines
2.7 KiB
Nginx Configuration File
master_process on;
|
|
|
|
worker_processes 1;
|
|
worker_cpu_affinity auto;
|
|
|
|
error_log logs/error.log warn;
|
|
pid logs/nginx.pid;
|
|
|
|
worker_rlimit_nofile 20480;
|
|
|
|
events {
|
|
accept_mutex off;
|
|
worker_connections 10620;
|
|
}
|
|
|
|
worker_shutdown_timeout 1;
|
|
|
|
http {
|
|
lua_package_path "$prefix/lua/?.lua;/usr/share/lua/5.1/?.lua;;";
|
|
lua_package_cpath '/usr/lib64/lua/5.1/?.so;;';
|
|
|
|
lua_shared_dict plugin-limit-req 10m;
|
|
lua_shared_dict plugin-limit-count 10m;
|
|
lua_shared_dict prometheus_metrics 10m;
|
|
|
|
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;
|
|
|
|
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;
|
|
more_set_headers 'Server: APISIX web server';
|
|
|
|
upstream backend {
|
|
server 0.0.0.1;
|
|
balancer_by_lua_block {
|
|
apisix.balancer_phase()
|
|
}
|
|
|
|
keepalive 32;
|
|
}
|
|
|
|
init_by_lua_block {
|
|
require "resty.core"
|
|
apisix = require("apisix")
|
|
apisix.init()
|
|
}
|
|
|
|
init_worker_by_lua_block {
|
|
apisix.init_worker()
|
|
}
|
|
|
|
server {
|
|
listen 9080;
|
|
|
|
include mime.types;
|
|
|
|
location = /apisix.com/nginx_status {
|
|
internal;
|
|
access_log off;
|
|
stub_status;
|
|
}
|
|
|
|
location / {
|
|
set $upstream_scheme 'http';
|
|
set $upstream_host $host;
|
|
set $upstream_upgrade '';
|
|
set $upstream_connection '';
|
|
set $upstream_uri '';
|
|
|
|
rewrite_by_lua_block {
|
|
apisix.rewrite_phase()
|
|
}
|
|
|
|
access_by_lua_block {
|
|
apisix.access_phase()
|
|
}
|
|
|
|
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;
|
|
proxy_pass $upstream_scheme://backend$upstream_uri;
|
|
|
|
header_filter_by_lua_block {
|
|
apisix.header_filter_phase()
|
|
}
|
|
|
|
log_by_lua_block {
|
|
apisix.log_phase()
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|