nginx.conf 2.4 KB

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