nginx_plain_php.conf 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # For use with the plain php
  2. #
  3. #
  4. user www-data;
  5. worker_processes auto;
  6. error_log stderr error;
  7. #worker_rlimit_nofile 100000;
  8. #timer_resolution 1000ms;
  9. daemon off;
  10. events {
  11. worker_connections 65536;
  12. multi_accept off;
  13. }
  14. http {
  15. include /etc/nginx/mime.types;
  16. access_log off;
  17. server_tokens off;
  18. sendfile off;
  19. tcp_nopush off;
  20. tcp_nodelay on;
  21. keepalive_timeout 65s;
  22. keepalive_disable none;
  23. keepalive_requests 10000;
  24. php_ini_path /deploy/conf/php.ini;
  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. include "fortune.php";
  46. ';
  47. }
  48. location = /dbraw {
  49. add_header Content-Type application/json;
  50. content_by_php '
  51. include "dbraw.php";
  52. ';
  53. }
  54. location /dbquery {
  55. add_header Content-Type application/json;
  56. content_by_php '
  57. $_GET = ngx::query_args();
  58. include "dbquery.php";
  59. ';
  60. }
  61. location /update {
  62. add_header Content-Type application/json;
  63. content_by_php '
  64. $_GET = ngx::query_args();
  65. include "updateraw.php";
  66. ';
  67. }
  68. # location = /info {
  69. # add_header Content-Type text/html;
  70. # content_by_php '
  71. # phpinfo();
  72. # ';
  73. # }
  74. }
  75. }