fastcgi_pass_fpm.j2 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {% if ansible_prolog -%}
  2. {% from 'templates/ansible/prolog.j2' import prolog with context %}
  3. {{ prolog() }}
  4. {% endif -%}
  5. #
  6. # fastcgi configuration for Nginx and PHP-FPM
  7. #
  8. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  9. fastcgi_param PATH_INFO $fastcgi_path_info;
  10. fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
  11. fastcgi_param QUERY_STRING $query_string;
  12. fastcgi_param REQUEST_METHOD $request_method;
  13. fastcgi_param CONTENT_TYPE $content_type;
  14. fastcgi_param CONTENT_LENGTH $content_length;
  15. fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  16. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  17. fastcgi_param REQUEST_URI $request_uri;
  18. fastcgi_param DOCUMENT_URI $document_uri;
  19. fastcgi_param DOCUMENT_ROOT $document_root;
  20. fastcgi_param SERVER_PROTOCOL $server_protocol;
  21. fastcgi_param REQUEST_SCHEME $scheme;
  22. fastcgi_param HTTPS $https if_not_empty;
  23. fastcgi_param GATEWAY_INTERFACE CGI/1.1;
  24. fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
  25. fastcgi_param REMOTE_ADDR $remote_addr;
  26. fastcgi_param REMOTE_PORT $remote_port;
  27. fastcgi_param SERVER_ADDR $server_addr;
  28. fastcgi_param SERVER_PORT $server_port;
  29. fastcgi_param SERVER_NAME $server_name;
  30. fastcgi_param REDIRECT_STATUS 200;
  31. {% if nginx_fpm_openbasedir_enforced %}
  32. fastcgi_param PHP_ADMIN_VALUE "upload_tmp_dir=/tmp\nopen_basedir=$document_root:/tmp:/usr/share:/tmp:/dev/random:/dev/urandom";
  33. {% endif %}
  34. {% if fpm_pools is defined and fpm_pools %}
  35. {% for pool in fpm_pools %}
  36. {% if fpm_pools[pool].default is defined and fpm_pools[pool].default %}
  37. fastcgi_pass fpm-backend-{{ pool }};
  38. {% endif %}
  39. {% endfor %}
  40. {% else %}
  41. fastcgi_pass fpm-backend;
  42. {% endif %}
  43. fastcgi_index index.php;
  44. fastcgi_buffer_size 8m;
  45. fastcgi_buffers 8 8m;