nginx.conf 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. user www-data;
  2. worker_cpu_affinity auto;
  3. worker_processes auto;
  4. error_log stderr error;
  5. worker_rlimit_nofile 1024000;
  6. timer_resolution 1000ms;
  7. daemon off;
  8. pcre_jit on;
  9. events {
  10. worker_connections 1000000;
  11. multi_accept off;
  12. }
  13. http {
  14. #include /etc/nginx/mime.types;
  15. access_log off;
  16. server_tokens off;
  17. msie_padding off;
  18. sendfile off;
  19. tcp_nopush off;
  20. tcp_nodelay on;
  21. keepalive_timeout 65s;
  22. keepalive_disable none;
  23. keepalive_requests 10000000;
  24. php_ini_path /deploy/conf/php.ini;
  25. init_worker_by_php '
  26. require "app.php";
  27. ';
  28. server {
  29. listen *:8080 backlog=65535 reuseport;
  30. root /;
  31. index index.html;
  32. php_keepalive 256;
  33. location = /hello {
  34. content_by_php '
  35. ngx_header_set("Content-Type", "text/plain");
  36. echo "Hello, World!";
  37. ';
  38. }
  39. location = /json {
  40. content_by_php '
  41. ngx_header_set("Content-Type", "application/json");
  42. echo json_encode(["message" => "Hello, World!"]);
  43. ';
  44. }
  45. location = /fortune {
  46. content_by_php '
  47. fortune();
  48. ';
  49. }
  50. location = /db {
  51. content_by_php '
  52. db();
  53. ';
  54. }
  55. location /query {
  56. content_by_php '
  57. query();
  58. ';
  59. }
  60. location /update {
  61. content_by_php '
  62. update();
  63. ';
  64. }
  65. # location = /info {
  66. # add_header Content-Type text/html;
  67. # content_by_php '
  68. # phpinfo();
  69. # ';
  70. # }
  71. }
  72. }