nginx.conf 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # user nginx;
  2. worker_processes auto;
  3. error_log /var/log/nginx/error.log warn;
  4. pid /var/run/nginx.pid;
  5. events {
  6. # The maximum number of connections that each worker process can handle simultaneously. The default is 512, but most systems have enough resources to support a larger number. The appropriate setting depends on the size of the server and the nature of the traffic, and can be discovered through testing.
  7. worker_connections 65535;
  8. # This directive allows a worker to accept many connections in the queue at a time. A queue in this context simply means a sequence of data objects waiting to be processed.
  9. multi_accept on;
  10. # With this directive worker processes will accept new connections by turn. Otherwise, all worker processes will be notified about new connections, and if volume of new connections is low, some of the worker processes may just waste system resources.
  11. accept_mutex on;
  12. # This directive determines how long a worker should wait before accepting a new connection. Once the accept_mutex is turned on, a mutex lock is assigned to a worker for a timeframe specified by the accept_mutex_delay . When the timeframe is up, the next worker in line is ready to accept new connections.
  13. accept_mutex_delay 200ms;
  14. # This directive specifies the method to process a connection from the client. We decided to set the value to epoll because we are working on a Ubuntu platform. The epoll method is the most effective processing method for Linux platforms.
  15. use epoll;
  16. # This specifies the number of events that NGINX will pass to the kernel.
  17. epoll_events 1024;
  18. }
  19. http {
  20. include /etc/nginx/mime.types;
  21. default_type application/octet-stream;
  22. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  23. '$status $body_bytes_sent "$http_referer" '
  24. '"$http_user_agent" "$http_x_forwarded_for"';
  25. access_log /var/log/nginx/access.log main;
  26. sendfile on;
  27. #tcp_nopush on;
  28. keepalive_timeout 65;
  29. #gzip on;
  30. server_names_hash_bucket_size 64;
  31. server_names_hash_max_size 512;
  32. include /etc/nginx/conf.d/*.conf;
  33. }