# Curl, Nginx and the connections conundrum

**URL:** <https://www.ruby-forum.com/t/curl-nginx-and-the-connections-conundrum/221850>\
**Category:** NGINX\
**Created:** [August 2, 2012, 4:33am UTC](https://www.ruby-forum.com/t/curl-nginx-and-the-connections-conundrum/221850 "2012-08-02T04:33:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 2, 2012, 4:33am UTC](https://www.ruby-forum.com/t/curl-nginx-and-the-connections-conundrum/221850/1 "2012-08-02T04:33:36Z")

</div>

Hey folks,

I’d like to turn your attentions to this frustrating issue I’ve been  
facing.

I’m running a dedicated server… Centos 6, PHP 5.3.3, Nginx 1.0.15.  
Great hardware, no problems.

Nginx uses fastcgi to run php.

The server communicates with another server using remote sql.

A file called download.php initiates a mysql connection, checks some  
details in the database and then begins streaming bytes to the user with  
content-displacement.

No matter what I do, I cannot get simultaneous connections to download a  
file above 5. For instance if I download a file using a download  
manager, a maximum of 5 connections can be made, the rest timeout.

I’ve setup nginx to accept up to 32 connections, mysql connection is  
closed before the file begins to stream so there shouldn’t be connection  
limit issues there.

According to the logs, Nginx seems to be giving a return code 499 on the  
6th request.

Also it’s max 5 connections every time, and when I want to download a  
second file it won’t start because there’s a maximum of 5 connections  
for my ip.

Does anybody have any idea how I can increase the amount of connections?  
Perhaps an idea of what else I can check?

I’ve also posted my troubles here:

> <https://stackoverflow.com/questions/11769520/linux-server-file-download-connection-limit>

Thanks.

Posted at Nginx Forum:

> **[Curl, Nginx and the connections conundrum.](https://forum.nginx.org/read.php?2,229216,229216#msg-229216)**
>
> Hey folks, I'd like to turn your attentions to this frustrating issue I've been facing. I'm running a dedicated server... Centos 6, PHP 5.3.3, Nginx 1.0.15. Great hardware, no problems. Nginx uses fastcgi to run php. The server communicates

---

<div class="post-metadata">

**Author:** ![jakecattrall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@jakecattrall](https://www.ruby-forum.com/u/jakecattrall)\
**Post date:** [August 2, 2012, 6:06pm UTC](https://www.ruby-forum.com/t/curl-nginx-and-the-connections-conundrum/221850/2 "2012-08-02T18:06:25Z")

</div>

Perfect, thanks for the advice.

Edit /etc/init.d/php\_cgi  
set server\_childs=32

Posted at Nginx Forum:

> **[Re: Curl, Nginx and the connections conundrum.](https://forum.nginx.org/read.php?2,229216,229253#msg-229253)**
>
> Hey folks, I'd like to turn your attentions to this frustrating issue I've been facing. I'm running a dedicated server... Centos 6, PHP 5.3.3, Nginx 1.0.15. Great hardware, no problems. Nginx uses fastcgi to run php. The server communicates

---

<div class="post-metadata">

**Author:** ![jakecattrall](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@jakecattrall](https://www.ruby-forum.com/u/jakecattrall)\
**Post date:** [August 2, 2012, 8:55am UTC](https://www.ruby-forum.com/t/curl-nginx-and-the-connections-conundrum/221850/3 "2012-08-02T08:55:22Z")

</div>

On 2012-08-02 04:32, jakecattrall wrote:

> The server communicates with another server using remote sql.
> 
> A file called download.php initiates a mysql connection, checks some  
> details in the database and then begins streaming bytes to the user  
> with  
> content-displacement.
> 
> No matter what I do, I cannot get simultaneous connections to  
> download a  
> file above 5. For instance if I download a file using a download  
> manager, a maximum of 5 connections can be made, the rest timeout.  
> […]

Have you checked the ‘pm.max\_children’ setting in php-fpm.conf?

-cs
