Advertisement
aka40

Nginx main config

Jan 25th, 2014
2,393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. user nobody;
  2. # no need for more workers in the proxy mode
  3. worker_processes 2;
  4. error_log /var/log/nginx/error.log info;
  5. worker_rlimit_nofile 20480;
  6. events {
  7. worker_connections 5120; # increase for busier servers
  8. use epoll; # you should use epoll here for Linux kernels 2.6.x
  9. }
  10.  
  11. http {
  12. server_name_in_redirect off;
  13. server_names_hash_max_size 10240;
  14. server_names_hash_bucket_size 1024;
  15. include mime.types;
  16. default_type application/octet-stream;
  17. server_tokens off;
  18.  
  19. # remove/commentout disable_symlinks if_not_owner;if you get Permission denied error
  20. # disable_symlinks if_not_owner;
  21. sendfile on;
  22. tcp_nopush on;
  23. tcp_nodelay on;
  24. keepalive_timeout 5;
  25. types_hash_max_size 2048;
  26.  
  27. # enable gzip
  28. gzip on;
  29. gzip_vary on;
  30. gzip_disable "MSIE [1-6]\.";
  31. gzip_proxied any;
  32. gzip_http_version 1.1;
  33. gzip_min_length 1000;
  34. gzip_comp_level 6;
  35. gzip_buffers 16 8k;
  36. # You can remove image/png image/x-icon image/gif image/jpeg if you have slow CPU
  37. gzip_types text/plain text/xml text/css application/x-javascript application/xml image/png image/x-icon image/gif image/jpeg application/xml+rss text/javascript application/atom+xml;
  38. ignore_invalid_headers on;
  39. client_header_timeout 3m;
  40. client_body_timeout 3m;
  41. send_timeout 3m;
  42. reset_timedout_connection on;
  43. connection_pool_size 256;
  44. client_header_buffer_size 256k;
  45. large_client_header_buffers 4 256k;
  46. client_max_body_size 200M;
  47. client_body_buffer_size 128k;
  48. request_pool_size 32k;
  49. output_buffers 4 32k;
  50. postpone_output 1460;
  51. proxy_temp_path /tmp/nginx_proxy/;
  52. client_body_in_file_only on;
  53. log_format bytes_log "$msec $bytes_sent .";
  54. include "/etc/nginx/vhosts/*";
  55.  
  56. # cache
  57. open_file_cache max=1000 inactive=20s;
  58. open_file_cache_valid 30s;
  59. open_file_cache_min_uses 2;
  60. open_file_cache_errors on;
  61. keepalive_requests 100000;
  62.  
  63. # Proxy Settings
  64. proxy_connect_timeout 90;
  65. proxy_send_timeout 90;
  66. proxy_read_timeout 90;
  67. proxy_buffer_size 4k;
  68. proxy_buffers 4 32k;
  69. proxy_busy_buffers_size 64k;
  70. proxy_temp_file_write_size 64k;
  71.  
  72. limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
  73.  
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement