nginx_async.conf 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. user www-data;
  2. worker_processes auto;
  3. error_log stderr error;
  4. #worker_rlimit_nofile 100000;
  5. #timer_resolution 1000ms;
  6. daemon off;
  7. events {
  8. worker_connections 65536;
  9. multi_accept off;
  10. }
  11. http {
  12. include /etc/nginx/mime.types;
  13. access_log off;
  14. server_tokens off;
  15. sendfile off;
  16. tcp_nopush off;
  17. tcp_nodelay on;
  18. keepalive_timeout 65s;
  19. keepalive_disable none;
  20. keepalive_requests 10000;
  21. php_ini_path /deploy/conf/php.ini;
  22. init_worker_by_php '
  23. require "app-async.php";
  24. ';
  25. server {
  26. listen 8080 default_server reuseport;
  27. root /;
  28. index index.html;
  29. php_keepalive 200;
  30. location = /hello {
  31. add_header Content-Type text/plain;
  32. content_by_php '
  33. echo "Hello, World!";
  34. ';
  35. }
  36. location = /json {
  37. add_header Content-Type application/json;
  38. content_by_php '
  39. echo json_encode(["message" => "Hello, World!"]);
  40. ';
  41. }
  42. location = /fortune {
  43. add_header Content-Type "text/html; charset=UTF-8";
  44. content_by_php '
  45. yield from fortune();
  46. ';
  47. }
  48. }
  49. }