nginx.conf 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 256;
  30. location = /hello {
  31. content_by_php '
  32. ngx_header_set("Content-Type", "text/plain");
  33. echo "Hello, World!";
  34. ';
  35. }
  36. location = /json {
  37. content_by_php '
  38. ngx_header_set("Content-Type", "application/json");
  39. echo json_encode(["message" => "Hello, World!"]);
  40. ';
  41. }
  42. location = /fortune {
  43. content_by_php '
  44. fortune();
  45. ';
  46. }
  47. location = /db {
  48. content_by_php '
  49. db();
  50. ';
  51. }
  52. location /query {
  53. content_by_php '
  54. query();
  55. ';
  56. }
  57. location /update {
  58. content_by_php '
  59. update();
  60. ';
  61. }
  62. # location = /info {
  63. # add_header Content-Type text/html;
  64. # content_by_php '
  65. # phpinfo();
  66. # ';
  67. # }
  68. }
  69. }