nginx.conf 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. http {
  2. include log.conf;
  3. server {
  4. listen 8080;
  5. include cert/cert.conf;
  6. include api.conf;
  7. include www.conf;
  8. }
  9. # https://nginx.org/en/docs/http/ngx_http_core_module.html
  10. resolver 1.1.1.1 ipv6=off;
  11. resolver_timeout 10s;
  12. keepalive_timeout 60;
  13. keepalive_requests 2048;
  14. server_tokens off;
  15. underscores_in_headers on;
  16. # https://nginx.org/en/docs/http/ngx_http_ssl_module.html
  17. ssl_protocols TLSv1.2 TLSv1.3;
  18. ssl_ciphers TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-256-GCM-SHA384:TLS13-AES-128-GCM-SHA256:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
  19. ssl_session_cache shared:SSL:30m;
  20. ssl_session_timeout 1d;
  21. ssl_prefer_server_ciphers on;
  22. # https://nginx.org/en/docs/http/ngx_http_limit_req_module.html
  23. limit_req_log_level warn;
  24. limit_req_zone $binary_remote_addr zone=reqip:16m rate=100r/s;
  25. limit_req zone=reqip burst=200 nodelay;
  26. access_log logs/proxy.log log_proxy buffer=64k flush=1s;
  27. # https://nginx.org/cn/docs/http/ngx_http_proxy_module.html
  28. # 1MB = 8000key
  29. proxy_cache_path cache
  30. levels=1:2
  31. keys_zone=my_cache:32m
  32. max_size=20g
  33. inactive=6h
  34. use_temp_path=off
  35. ;
  36. proxy_http_version 1.1;
  37. proxy_ssl_server_name on;
  38. proxy_buffer_size 16k;
  39. proxy_buffers 4 32k;
  40. proxy_busy_buffers_size 64k;
  41. proxy_send_timeout 30s;
  42. proxy_read_timeout 30s;
  43. proxy_connect_timeout 10s;
  44. lua_load_resty_core off;
  45. map $http_origin $_origin_id {
  46. include allowed-sites.conf;
  47. }
  48. }
  49. # https://nginx.org/en/docs/ngx_core_module.html
  50. events {
  51. worker_connections 4096;
  52. }