nginx_php.conf 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. user www-data;
  2. worker_processes auto;
  3. error_log stderr error;
  4. worker_rlimit_nofile 200000;
  5. daemon off;
  6. events {
  7. worker_connections 16384;
  8. multi_accept on;
  9. }
  10. http {
  11. include /etc/nginx/mime.types;
  12. access_log off;
  13. server_tokens off;
  14. sendfile on;
  15. tcp_nopush on;
  16. tcp_nodelay on;
  17. keepalive_timeout 65;
  18. open_file_cache max=2000 inactive=20s;
  19. open_file_cache_valid 60s;
  20. open_file_cache_min_uses 5;
  21. open_file_cache_errors off;
  22. php_ini_path /deploy/conf/php.ini;
  23. server {
  24. listen 8080 reuseport;
  25. server_name localhost;
  26. root /;
  27. index index.html;
  28. location /hello {
  29. add_header Content-Type text/plain;
  30. content_by_php '
  31. echo "Hello, World!";
  32. ';
  33. }
  34. location /json {
  35. add_header Content-Type application/json;
  36. content_by_php '
  37. echo json_encode(["message" => "Hello, World!"]);
  38. ';
  39. }
  40. location /dbraw {
  41. add_header Content-Type application/json;
  42. content_by_php '
  43. $_GET = ngx::query_args();
  44. include "/dbraw.php";
  45. ';
  46. }
  47. location /fortune {
  48. add_header Content-Type "text/html; charset=UTF-8";
  49. content_by_php '
  50. include "/fortune.php";
  51. ';
  52. }
  53. location /update {
  54. add_header Content-Type application/json;
  55. content_by_php '
  56. $_GET = ngx::query_args();
  57. include "/updateraw.php";
  58. ';
  59. }
  60. }
  61. }