How to set proxy_read_timeout in nginx?
In nginx, you can use the proxy_read_timeout directive to set the timeout for reading responses from the backend server. The syntax of this directive is as follows:
proxy_read_timeout time;
In this case, time represents the timeout period and can be either an integer or a time unit. For example, the following values can be used to set the timeout period:
- time is an integer representing the number of seconds for the timeout duration.
- ‘Time’ ending with ‘ms’ indicates the timeout duration in milliseconds.
- The time ending in ‘s’ represents the number of seconds for the timeout period.
- “time ending with m indicates the number of minutes of timeout duration.”
- The “time” ending with “h” represents the number of hours for the timeout period.
- The term “time” ending with “d” indicates the number of days for the timeout period.
For example, the following configuration sets the proxy_read_timeout to 30 seconds:
proxy_read_timeout 30s;
It is important to note that proxy_read_timeout only applies to the proxy server and not to the time taken to send a response to the client. If you need to set a timeout for sending a response to the client, you can use the send_timeout directive.