nginx.conf 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. pcre_jit on;
  8. events {
  9. worker_connections 65536;
  10. multi_accept off;
  11. }
  12. http {
  13. include /etc/nginx/mime.types;
  14. access_log off;
  15. server_tokens off;
  16. sendfile off;
  17. tcp_nopush off;
  18. tcp_nodelay on;
  19. keepalive_timeout 65s;
  20. keepalive_disable none;
  21. keepalive_requests 200000;
  22. php_ini_path /deploy/conf/php.ini;
  23. init_worker_by_php '
  24. require "app.php";
  25. ';
  26. server {
  27. listen 8080 default_server reuseport;
  28. root /;
  29. index index.html;
  30. php_keepalive 256;
  31. location = /hello {
  32. content_by_php '
  33. ngx_header_set("Content-Type", "text/plain");
  34. echo "Hello, World!";
  35. ';
  36. }
  37. location = /json {
  38. content_by_php '
  39. ngx_header_set("Content-Type", "application/json");
  40. echo json_encode(["message" => "Hello, World!"]);
  41. ';
  42. }
  43. location = /fortune {
  44. content_by_php '
  45. fortune();
  46. ';
  47. }
  48. location = /db {
  49. content_by_php '
  50. db();
  51. ';
  52. }
  53. location /query {
  54. content_by_php '
  55. query();
  56. ';
  57. }
  58. location /update {
  59. content_by_php '
  60. update();
  61. ';
  62. }
  63. # location = /info {
  64. # add_header Content-Type text/html;
  65. # content_by_php '
  66. # phpinfo();
  67. # ';
  68. # }
  69. }
  70. }