fastcgi_pass_fpm.j2 1.9 KB

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