OpenSource CLI-App to install and handle stuff related to Web-Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
2.7 KiB

  1. # set user for nginx
  2. user {{ $user }};
  3. # you must set worker processes based on your CPU cores
  4. worker_processes {{ $processes }};
  5. # number of file descriptors used for nginx
  6. # the limit for the maximum FDs on the server is usually set by the OS.
  7. # if you don't set FD's then OS settings will be used which is by default 2000
  8. worker_rlimit_nofile 100000;
  9. pid /run/nginx.pid;
  10. events {
  11. # determines how much clients will be served per worker
  12. worker_connections {{ $connections }};
  13. # optimized to serve many clients with each thread, essential for linux
  14. use epoll;
  15. # accept as many connections as possible
  16. multi_accept on;
  17. }
  18. http {
  19. server_tokens off;
  20. @if ($environment === 'development')
  21. # error log will be only write from debug
  22. error_log /var/log/nginx.error_log debug;
  23. @else
  24. # error log will be only write from warn-level
  25. error_log /var/log/nginx.error_log warn;
  26. # no logging for 3XX
  27. map $status $loggable {
  28. ~^[3] 0;
  29. default 1;
  30. }
  31. # send headers in one piece, it is better than sending them one by one
  32. tcp_nopush on;
  33. # don't buffer data sent, good for small data bursts in real time
  34. tcp_nodelay on;
  35. # caching
  36. # optimizes serving static files from the file system
  37. sendfile on;
  38. # assets file, 1000 files for 30 seconds
  39. open_file_cache max=200000 inactive=20s;
  40. open_file_cache_valid 30s;
  41. open_file_cache_min_uses 2;
  42. open_file_cache_errors on;
  43. @endif
  44. #buffer
  45. client_body_buffer_size 128k;
  46. client_max_body_size 250m;
  47. client_header_buffer_size 1k;
  48. large_client_header_buffers 4 4k;
  49. output_buffers 1 32k;
  50. postpone_output 1460;
  51. # allow the server to close connection on non responding client, this will free up memory
  52. reset_timedout_connection on;
  53. # server will close connection after this time -- default 75
  54. keepalive_timeout 30;
  55. client_header_timeout 3m;
  56. client_body_timeout 10m;
  57. send_timeout 3m;
  58. # compress files, but not on older version of IE
  59. gzip on;
  60. gzip_min_length 1000;
  61. gzip_vary on;
  62. gzip_proxied expired no-cache no-store private auth;
  63. gzip_disable "MSIE [1-6]\.";
  64. gzip_types
  65. application/x-javascript
  66. text/css
  67. application/javascript
  68. text/javascript
  69. text/plain
  70. text/xml
  71. application/json
  72. application/vnd.ms-fontobject
  73. application/x-font-opentype
  74. application/x-font-truetype
  75. application/x-font-ttf
  76. application/xml
  77. font/eot
  78. font/opentype
  79. font/otf
  80. image/svg+xml
  81. image/vnd.microsoft.icon;
  82. # includes
  83. include /etc/nginx/conf.d/*.conf;
  84. include /etc/nginx/sites-enabled/*.conf;
  85. include /etc/nginx/mime.types;
  86. }