• Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
logo logo
  • Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
ENEN
  • 简体简体
  • 繁體繁體
Client Area

Nginx Command: lingering_timeout

December 18, 2023

Nginx Command: lingering_timeout

In the world of web servers, Nginx has gained immense popularity due to its high performance, scalability, and flexibility. It is widely used to serve static content, reverse proxy, and load balance web applications. One of the many powerful features of Nginx is the ability to configure various timeouts to optimize server performance. In this article, we will explore the “lingering_timeout” command in Nginx and its significance.

Understanding Lingering Connections

Before diving into the “lingering_timeout” command, let’s first understand what lingering connections are. In the context of Nginx, a lingering connection refers to a situation where a client keeps the connection open even after the response has been sent by the server. This can happen due to various reasons, such as slow client connections or network congestion.

Lingering connections can have a significant impact on server resources, as they tie up valuable server slots that could be used to serve other clients. Therefore, it is crucial to handle lingering connections efficiently to ensure optimal server performance.

The “lingering_timeout” Command

The “lingering_timeout” command in Nginx allows you to specify the maximum time a connection can remain open after the response has been sent. By default, Nginx sets the lingering timeout to 0, which means that lingering connections are immediately closed after the response is sent.

However, in certain scenarios, it may be beneficial to keep the connection open for a longer duration. For example, if you expect clients with slow connections or if you want to reduce the overhead of establishing new connections for subsequent requests from the same client.

To configure the “lingering_timeout” command, you need to add it to the Nginx configuration file within the “http” block. Here’s an example:

http {
    lingering_timeout 30s;
}

In the above example, we have set the lingering timeout to 30 seconds. This means that if a client keeps the connection open for more than 30 seconds after the response has been sent, Nginx will close the connection.

Benefits of Lingering Connections

Enabling lingering connections can provide several benefits:

  • Reduced connection overhead: By keeping the connection open, subsequent requests from the same client can reuse the existing connection, reducing the overhead of establishing new connections.
  • Improved performance: Lingering connections can help improve performance for clients with slow connections, as they don’t need to establish a new connection for each request.
  • Optimized resource utilization: By efficiently handling lingering connections, server resources can be utilized more effectively, allowing the server to handle a higher number of concurrent clients.

Conclusion

The “lingering_timeout” command in Nginx is a powerful tool to handle lingering connections efficiently. By configuring an appropriate timeout value, you can optimize server performance, reduce connection overhead, and improve resource utilization. Understanding and utilizing this command can greatly enhance the performance and scalability of your web applications.

Summary:

In this article, we explored the “lingering_timeout” command in Nginx and its significance. Lingering connections can have a significant impact on server resources, and the “lingering_timeout” command allows you to specify the maximum time a connection can remain open after the response has been sent. By configuring an appropriate timeout value, you can optimize server performance, reduce connection overhead, and improve resource utilization. To learn more about VPS hosting and how it can benefit your business, visit Server.HK.

Recent Posts

  • How to Configure SELinux in CentOS Without Breaking Your System (CentOS Stream 9/10 – 2026)
  • Managing Users and Permissions in CentOS Stream: Best Practices (CentOS Stream 9/10 – 2026)
  • How to Set Up Nginx on CentOS Stream for High-Performance Web Hosting
  • CentOS Stream Explained: Key Differences from CentOS Linux
  • How to Configure FirewallD in CentOS Stream: From Essential to Production-Grade

Recent Comments

No comments to show.

Knowledge Base

Access detailed guides, tutorials, and resources.

Live Chat

Get instant help 24/7 from our support team.

Send Ticket

Our team typically responds within 10 minutes.

logo
Alipay Cc-paypal Cc-stripe Cc-visa Cc-mastercard Bitcoin
Cloud VPS
  • Hong Kong VPS
  • US VPS
Dedicated Servers
  • Hong Kong Servers
  • US Servers
  • Singapore Servers
  • Japan Servers
More
  • Contact Us
  • Blog
  • Legal
© 2026 Server.HK | Hosting Limited, Hong Kong | Company Registration No. 77008912
Telegram
Telegram @ServerHKBot