nginx.conf 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. http {
  2. server {
  3. ssl_certificate cert/ecc.cer;
  4. ssl_certificate_key cert/ecc.key;
  5. listen 8443 ssl http2;
  6. listen 8080;
  7. include api.conf;
  8. }
  9. server {
  10. listen 10080; # redir from 80
  11. access_log off;
  12. location /.well-known/acme-challenge/ {
  13. root ../acme;
  14. }
  15. location = /works {
  16. return 200 works;
  17. }
  18. }
  19. # https://nginx.org/en/docs/http/ngx_http_core_module.html
  20. resolver 1.1.1.1 ipv6=off;
  21. resolver_timeout 10s;
  22. keepalive_timeout 60;
  23. keepalive_requests 2048;
  24. server_tokens off;
  25. underscores_in_headers on;
  26. # https://nginx.org/en/docs/http/ngx_http_ssl_module.html
  27. ssl_protocols TLSv1.2 TLSv1.3;
  28. ssl_ciphers TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-256-GCM-SHA384:TLS13-AES-128-GCM-SHA256:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
  29. ssl_session_cache shared:SSL:30m;
  30. ssl_session_timeout 1d;
  31. ssl_prefer_server_ciphers on;
  32. # https://nginx.org/en/docs/http/ngx_http_limit_req_module.html
  33. limit_req_log_level warn;
  34. limit_req_zone $binary_remote_addr zone=reqip:16m rate=100r/s;
  35. limit_req zone=reqip burst=200 nodelay;
  36. # https://nginx.org/en/docs/http/ngx_http_log_module.html
  37. # separated by tab (\t)
  38. log_format log_proxy escape=none
  39. '02 ' # ver prefix
  40. '$time_iso8601 $_origin_id $_ver $remote_addr '
  41. '$_level $_switched $upstream_cache_status $request_time '
  42. '$request_length $bytes_sent '
  43. '$request_method $_url $status $_bodyhash $upstream_http_access_control_allow_origin '
  44. '$http_user_agent $_ref $_mode $_type'
  45. ;
  46. access_log logs/proxy.log log_proxy buffer=64k flush=1s;
  47. # https://nginx.org/cn/docs/http/ngx_http_proxy_module.html
  48. # 1MB = 8000key
  49. proxy_cache_path cache
  50. levels=1:2
  51. keys_zone=my_cache:32m
  52. max_size=20g
  53. inactive=6h
  54. use_temp_path=off
  55. ;
  56. proxy_http_version 1.1;
  57. proxy_ssl_server_name on;
  58. proxy_buffer_size 16k;
  59. proxy_buffers 4 32k;
  60. proxy_busy_buffers_size 64k;
  61. proxy_send_timeout 10s;
  62. lua_load_resty_core off;
  63. map $http_origin $_origin_id {
  64. '' 'mysite';
  65. include allowed-sites.conf;
  66. }
  67. }
  68. # https://nginx.org/en/docs/ngx_core_module.html
  69. events {
  70. worker_connections 4096;
  71. }