nginx.conf 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.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. fortune();
  46. ';
  47. }
  48. location = /db {
  49. add_header Content-Type application/json;
  50. content_by_php '
  51. db();
  52. ';
  53. }
  54. location /query {
  55. add_header Content-Type application/json;
  56. content_by_php '
  57. $_GET = ngx::query_args();
  58. query();
  59. ';
  60. }
  61. location /update {
  62. add_header Content-Type application/json;
  63. content_by_php '
  64. $_GET = ngx::query_args();
  65. update();
  66. ';
  67. }
  68. # location = /info {
  69. # add_header Content-Type text/html;
  70. # content_by_php '
  71. # phpinfo();
  72. # ';
  73. # }
  74. }
  75. }