在Nginx中,可以通过修改proxy_connect_timeout
和proxy_read_timeout
两个参数来设置超时时间。
proxy_connect_timeout
参数用于设置与上游服务器建立连接的超时时间,默认值为60秒。可以在http
、server
和location
块中进行设置。
示例:
http {
...
proxy_connect_timeout 10s;
...
}
proxy_read_timeout
参数用于设置从上游服务器读取响应数据的超时时间,默认值为60秒。可以在http
、server
和location
块中进行设置。
示例:
http {
...
proxy_read_timeout 10s;
...
}
需要注意的是,这两个参数的单位可以使用s
表示秒,ms
表示毫秒。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:nginx反向代理连接超时怎么解决