mirror of
https://github.com/cytopia/devilbox.git
synced 2025-04-08 03:24:15 +00:00
Make timeout from httpd to php-fpm configurable
This commit is contained in:
parent
e28d56b053
commit
c0e220b1bd
@ -204,7 +204,7 @@ services:
|
||||
# Web Server
|
||||
# ------------------------------------------------------------
|
||||
httpd:
|
||||
image: devilbox/${HTTPD_SERVER:-nginx-stable}:0.20
|
||||
image: devilbox/${HTTPD_SERVER:-nginx-stable}:0.21
|
||||
|
||||
environment:
|
||||
|
||||
@ -253,6 +253,7 @@ services:
|
||||
- PHP_FPM_ENABLE=1
|
||||
- PHP_FPM_SERVER_ADDR=php
|
||||
- PHP_FPM_SERVER_PORT=9000
|
||||
- PHP_FPM_TIMEOUT=${HTTPD_TIMEOUT_TO_PHP_FPM:-180}
|
||||
|
||||
ports:
|
||||
# ---- Format: ----
|
||||
|
@ -1401,6 +1401,32 @@ changing the server name or adding locations to other assets.
|
||||
..
|
||||
* :ref:`customize_all_virtual_hosts_globally`
|
||||
|
||||
.. _env_httpd_timeout_to_php_fpm:
|
||||
|
||||
HTTPD_TIMEOUT_TO_PHP_FPM
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This variable specifies after how many seconds the webserver should quit an unanswered connection
|
||||
to PHP-FPM.
|
||||
|
||||
Ensure that this value is higher than PHP's ``max_execution_time``, otherwise the PHP script
|
||||
could still run and the webserver will simply drop the connection before getting an answer
|
||||
by PHP.
|
||||
|
||||
If ``HTTPD_TIMEOUT_TO_PHP_FPM`` is smaller then ``max_execution_time`` and a script runs longer
|
||||
than ``max_execution_time``, you will get a: ``504 Gateway timeout`` in the browser.
|
||||
|
||||
If ``HTTPD_TIMEOUT_TO_PHP_FPM`` is greater then ``max_execution_time`` and a script runs longer
|
||||
than ``max_execution_time``, you will get a proper PHP error message in the browser.
|
||||
|
||||
|
||||
+------------------------------+-------------------+------------------+
|
||||
| Name | Allowed values | Default value |
|
||||
+==============================+===================+==================+
|
||||
| ``HTTPD_TIMEOUT_TO_PHP_FPM`` | positive integer | ``180`` |
|
||||
+------------------------------+-------------------+------------------+
|
||||
|
||||
|
||||
MySQL
|
||||
-----
|
||||
|
||||
|
@ -54,7 +54,7 @@ separetely.
|
||||
Virtual host domains
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
Each of your virtual host will have its own domain. TLD can be freely chosen, such as ``*.loc`` or
|
||||
``*.local``. Be aware that some TLD's can cause problems. Read more here: :ref:`_env_tld_suffix`.
|
||||
``*.local``. Be aware that some TLD's can cause problems. Read more here: :ref:`env_tld_suffix`.
|
||||
|
||||
|
||||
Service and version choice
|
||||
|
@ -207,10 +207,12 @@ Check your Docker settings to allow shared volumes for the path of the Devilbox
|
||||
This error occurs when the upstream PHP-FPM server takes longer to execute a script,
|
||||
than the timeout value set in the web server for PHP-FPM to answer.
|
||||
|
||||
For that to fix one must increase the PHP-FPM/Proxy timeout settings on the virtual host.
|
||||
For that to fix one must increase the PHP-FPM/Proxy timeout settings in the ``.env`` file.
|
||||
:ref:`env_httpd_timeout_to_php_fpm`
|
||||
|
||||
.. seealso::
|
||||
|
||||
* :ref:`env_httpd_timeout_to_php_fpm`
|
||||
* https://github.com/cytopia/devilbox/issues/280
|
||||
* https://github.com/cytopia/devilbox/issues/234
|
||||
|
||||
|
10
env-example
10
env-example
@ -478,6 +478,16 @@ HTTPD_DOCROOT_DIR=htdocs
|
||||
HTTPD_TEMPLATE_DIR=.devilbox
|
||||
|
||||
|
||||
###
|
||||
### Webserver timeout (in seconds) to upstream PHP-FPM server
|
||||
###
|
||||
### This value should be greater than PHP's max_execution_time,
|
||||
### otherwise the php script could still run and the webserver will
|
||||
### simply drop the connection before getting an answer by PHP.
|
||||
###
|
||||
HTTPD_TIMEOUT_TO_PHP_FPM=180
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
###
|
||||
|
@ -120,7 +120,7 @@ features:
|
||||
# PHP-FPM will not be applied to a reverse proxy!
|
||||
php_fpm: |
|
||||
# PHP-FPM Definition
|
||||
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://__PHP_ADDR__:__PHP_PORT____DOCUMENT_ROOT__/$1
|
||||
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://__PHP_ADDR__:__PHP_PORT____DOCUMENT_ROOT__/$1 timeout=__PHP_TIMEOUT__
|
||||
|
||||
alias: |
|
||||
# Alias Definition
|
||||
|
@ -131,6 +131,8 @@ features:
|
||||
</FilesMatch>
|
||||
|
||||
<Proxy "fcgi://__PHP_ADDR__:__PHP_PORT__/">
|
||||
ProxySet timeout=__PHP_TIMEOUT__
|
||||
ProxySet connectiontimeout=__PHP_TIMEOUT__
|
||||
</Proxy>
|
||||
|
||||
# If the php file doesn't exist, disable the proxy handler.
|
||||
|
@ -112,10 +112,14 @@ features:
|
||||
try_files $uri = 404;
|
||||
include fastcgi_params;
|
||||
|
||||
# https://stackoverflow.com/questions/1733306/nginx-errors-readv-and-recv-failed/51457613#51457613
|
||||
fastcgi_keep_conn off;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_split_path_info ^(.+\.php)(.*)$;
|
||||
|
||||
fastcgi_pass __PHP_ADDR__:__PHP_PORT__;
|
||||
fastcgi_read_timeout __PHP_TIMEOUT__;
|
||||
|
||||
fastcgi_index index.php;
|
||||
fastcgi_intercept_errors on;
|
||||
|
Loading…
x
Reference in New Issue
Block a user