# Transforming nginx for Windows

**URL:** <https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412>\
**Category:** NGINX\
**Created:** [September 1, 2013, 10:59pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412 "2013-09-01T22:59:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [September 1, 2013, 10:59pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/1 "2013-09-01T22:59:21Z")

</div>

Working on getting real high performance with nginx under windows I am  
rewriting code and already got around the fd\_setsize issue following

which is documented as [http://support.microsoft.com/kb/111855](http://support.microsoft.com/kb/111855)

I came across an interesting issue (FD\_SETSIZE compiled for 8196), when  
worker\_connections is set to 1024 I can get a max of 4500 true  
concurrent  
connections working, when worker\_connections is set to 2048 I can get a  
max  
of 9000 true concurrent connections working, is there some kind of  
recycling  
of FD going on inside nginx ? if not I need to look somewhere else.  
I intend to also solve the worker\_processes issue but I first want to  
find  
out who is recycling the FD’s.

Posted at Nginx Forum:

> **[Transforming nginx for Windows](https://forum.nginx.org/read.php?2,242426,242426#msg-242426)**
>
> Working on getting real high performance with nginx under windows I am rewriting code and already got around the fd\_setsize issue following http://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select/18530636 which is...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [September 2, 2013, 1:15am UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/2 "2013-09-02T01:15:28Z")

</div>

On Monday 02 September 2013 00:58:42 itpp2012 wrote:

> recycling of FD going on inside nginx ? if not I need to look somewhere  
> else. I intend to also solve the worker\_processes issue but I first want  
> to find out who is recycling the FD’s.

Yes, there is one. See the ngx\_drain\_connections() function with  
the accompanying ngx\_reusable\_connection().

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [September 2, 2013, 7:27pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/3 "2013-09-02T19:27:28Z")

</div>

Found them, tnx, no adjustment needed here, it’s dealing with the much  
larger FD table without problems. Got up to 12k concurrent connections  
today  
one worker one cpu at around 40% utilization, can’t get beyond that yet  
due  
to the test tool not being able to go beyond 12k 🙂

If anyone wants to test as well let me know, I can place the binary  
(based  
on 1.4.2) somewhere.

Valentin, can you explain what the problem is with multiple workers and  
which source files are involved?

Posted at Nginx Forum:

> **[Re: Transforming nginx for Windows](https://forum.nginx.org/read.php?2,242426,242468#msg-242468)**
>
> Working on getting real high performance with nginx under windows I am rewriting code and already got around the fd\_setsize issue following http://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select/18530636 which is...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [September 4, 2013, 9:31pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/4 "2013-09-04T21:31:03Z")

</div>

If you want to test along pushing the max concurrent limit here’s my  
experimental version:  
nginx 1.4.2 experimental b01.zip  
[http://www.sendspace.com/file/zc4ak8](http://www.sendspace.com/file/zc4ak8)  
MD5: 812ea5e77b39a11468291d9cb9b87503  
SHA1: a2fb9e89fb272a3b3ee6162667f88e662c591ba6

Got to 20k concurrent connections today, anyone know of a test tool that  
can  
go beyond 20k concurrent?

Posted at Nginx Forum:

> **[Re: Transforming nginx for Windows](https://forum.nginx.org/read.php?2,242426,242545#msg-242545)**
>
> Working on getting real high performance with nginx under windows I am rewriting code and already got around the fd\_setsize issue following http://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select/18530636 which is...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [September 11, 2013, 3:43pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/5 "2013-09-11T15:43:32Z")

</div>

On Sep 10, 2013, at 11:25 PM, itpp2012 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> setting the new ones
> 
> - Website created for easy download: [http://nginx-win.ecsds.eu/](http://nginx-win.ecsds.eu/)  
> Just checking if you have any patches against nginx-1.4 or nginx-1.5 to  
> share?

Thanks!

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [September 10, 2013, 9:26pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/6 "2013-09-10T21:26:30Z")

</div>

10:27 10-9-2013: B02 build

Based on nginx 1.4.2 with;  
pcre-8.32  
zlib-1.2.8  
openssl-1.0.1e

- Compiled with: FD\_SETSIZE = 16384 (original Windows source files  
modified)
- Now capable to handle C250K ! (with optimization registry file)
- Added Windows optimization registry file, check your current values  
BEFORE  
setting the new ones
- Added debug symbols file (let us know where it went wrong when you  
have a  
crash)
- Added adjusted nginx(-win).conf for Windows
- Added SPDY

- Runs on Windows XP SP3 or higher, both 32 and 64 bit
- Set priority to High for both nginx.exe processes
- When nginx is running as a service: My computer → Properties →   
Advanced  
 → Performance →   
Advanced → Processor scheduling, Adjust for best performance set to  
background services
- Website created for easy download: [http://nginx-win.ecsds.eu/](http://nginx-win.ecsds.eu/)

Posted at Nginx Forum:

> **[Re: Transforming nginx for Windows](https://forum.nginx.org/read.php?2,242426,242735#msg-242735)**
>
> Working on getting real high performance with nginx under windows I am rewriting code and already got around the fd\_setsize issue following http://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select/18530636 which is...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [September 23, 2013, 7:43pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/7 "2013-09-23T19:43:38Z")

</div>

Lua compiled in!

Transforming nginx for Windows:  
[Transforming nginx for Windows](http://forum.nginx.org/read.php?2,242426)  
[Redirecting to Google Groups](https://groups.google.com/forum/#!forum/openresty-en) (Lua nginx  
compiled  
for nginx windows)  
Builds can be found here:  
[http://nginx-win.ecsds.eu/](http://nginx-win.ecsds.eu/)

10:37 23-9-2013: nginx 1.5.6.1 Alice

Based on nginx 1.5.6 (22-9-2013) with;

- Streaming with nginx-rtmp-module, v1.0.4  
([http://nginx-rtmp.blogspot.nl/](http://nginx-rtmp.blogspot.nl/))
- lua-nginx-module v0.8.9 (tnx to agentzh about precompiled headers!)
- LuaJIT-2.0.2 =\> (lua51.dll include / lua51.lib build)
- Added lua51.dll (is required)
- ngx\_devel\_kit v0.2.15

- Additional specifications are like 10:27 10-9-2013: B02 build

Todo:

- Still working on the multiple worker issue.

Posted at Nginx Forum:

> **[Re: Transforming nginx for Windows](https://forum.nginx.org/read.php?2,242426,243071#msg-243071)**
>
> Working on getting real high performance with nginx under windows I am rewriting code and already got around the fd\_setsize issue following http://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select/18530636 which is...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [September 25, 2013, 7:44pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/8 "2013-09-25T19:44:19Z")

</div>

13:46 25-9-2013: nginx 1.5.6.3 Alice

Based on nginx 1.5.6 (25-9-2013) with;

- Bug fixes in lua-nginx-module(master 25-9-2013) and  
ngx\_devel\_kit(master  
25-9-2013) by agentzh
- Both debug and non-debug versions, the non-debug version is production  
use  
ready !

- vcredist\_x86 is required, get it here  
([http://www.microsoft.com/en-us/download/details.aspx?id=5555](http://www.microsoft.com/en-us/download/details.aspx?id=5555))
- Additional specifications are like 10:37 23-9-2013: nginx 1.5.6.1  
Alice
- 1.5.6.2 was skipped for public release

Builds can be found here:  
[http://nginx-win.ecsds.eu/](http://nginx-win.ecsds.eu/)

Posted at Nginx Forum:

> **[Re: Transforming nginx for Windows](https://forum.nginx.org/read.php?2,242426,243143#msg-243143)**
>
> Working on getting real high performance with nginx under windows I am rewriting code and already got around the fd\_setsize issue following http://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select/18530636 which is...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [September 11, 2013, 7:23pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/9 "2013-09-11T19:23:12Z")

</div>

## nginxorg Wrote:

> Just checking if you have any patches against nginx-1.4 or nginx-1.5  
> to share?
> 
> Thanks!

When the outstanding issues have been resolved all code will flow back  
into  
the community, my target is a Windows nginx version that can compile,  
perform and scale the same as the linux version. I’ve just setup a  
budget  
for some quality c++ programmers since my c++ knowledge is not enough to  
tackle everything. As asked before I would appreciate a technical  
explanation why windows issues are what they are as this would speed up  
working out a solution.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,242426,242761#msg-242761](http://forum.nginx.org/read.php?2,242426,242761#msg-242761)

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [September 25, 2013, 9:48pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/10 "2013-09-25T21:48:16Z")

</div>

Hello!

On Wed, Sep 25, 2013 at 10:43 AM, itpp2012 wrote:

> Based on nginx 1.5.6 (25-9-2013) with;
> 
> - Bug fixes in lua-nginx-module(master 25-9-2013) and ngx\_devel\_kit(master  
> 25-9-2013) by agentzh

First of all, thank you for the work on Windows! 🙂

It’ll be great if you can try running ngx\_lua (and other nginx  
modules’) test suite against your Windows build on Windows. The test  
scaffold is written in Perl which _may_ run on Windows out of the box  
🙂

Thanks!  
-agentzh

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [September 25, 2013, 11:57pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/11 "2013-09-25T23:57:27Z")

</div>

Hello!

On Wed, Sep 25, 2013 at 2:02 PM, itpp2012 wrote:

> Url of this scaffold? I can get anything running so this is going to be an  
> interesting test.

See the official documentation for the ngx\_lua test suite:

```
http://wiki.nginx.org/HttpLuaModule#Test_Suite

```

Good luck!  
-agentzh

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [September 25, 2013, 11:02pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/12 "2013-09-25T23:02:29Z")

</div>

> First of all, thank you for the work on Windows! 🙂

We’re getting there slowly! 🙂 I’ve got 2 workers working, just need to  
figure out why 🙂

> It’ll be great if you can try running ngx\_lua (and other nginx  
> modules’) test suite against your Windows build on Windows. The test  
> scaffold is written in Perl which _may_ run on Windows out of the box

Url of this scaffold? I can get anything running so this is going to be  
an  
interesting test.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,242426,243149#msg-243149](http://forum.nginx.org/read.php?2,242426,243149#msg-243149)

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [February 7, 2014, 7:06pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/13 "2014-02-07T19:06:47Z")

</div>

This is very nice. Thanks. I noticed the  
encrypted-session-nginx-module is  
missing from this build. Is there some reason you omitted it? Have you  
published any docs on how to build this ourselves in windows using your  
source code? Or is that obvious and I should RTM?

Posted at Nginx Forum:

> **[Re: Transforming nginx for Windows](https://forum.nginx.org/read.php?2,242426,247287#msg-247287)**
>
> Working on getting real high performance with nginx under windows I am rewriting code and already got around the fd\_setsize issue following http://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select/18530636 which is...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [March 6, 2014, 5:55pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/14 "2014-03-06T17:55:35Z")

</div>

How ready is this for production? I seem to be getting a lot of  
intermittent timeouts/dropped connections to the backend or something  
doing  
upstream proxying. Just wondering before I go digging into this any  
more.

Posted at Nginx Forum:

> **[Re: Transforming nginx for Windows](https://forum.nginx.org/read.php?2,242426,248190#msg-248190)**
>
> Working on getting real high performance with nginx under windows I am rewriting code and already got around the fd\_setsize issue following http://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select/18530636 which is...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [February 7, 2014, 7:35pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/15 "2014-02-07T19:35:29Z")

</div>

## tonyschwartz Wrote:

> This is very nice. Thanks. I noticed the  
> encrypted-session-nginx-module is missing from this build. Is there

No reason to omit it other then no one has requested it 🙂 I’ll have a  
look  
and add it if there are no cross source/module conflicts for the next  
release, at the moment we’re busy with integrating a select-boost api in  
the  
core.

> some reason you omitted it? Have you published any docs on how to  
> build this ourselves in windows using your source code? Or is that  
> obvious and I should RTM?

A Rtfm is always recommended 😉

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,242426,247288#msg-247288](http://forum.nginx.org/read.php?2,242426,247288#msg-247288)

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [March 6, 2014, 7:29pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/16 "2014-03-06T19:29:08Z")

</div>

## tonyschwartz Wrote:

> How ready is this for production? I seem to be getting a lot of  
> intermittent timeouts/dropped connections to the backend or something  
> doing upstream proxying. Just wondering before I go digging into this  
> any more.

It is ready for production use and it used in production servers, just  
keep  
an eye out for Beta’s which offer solutions to many other problems as we  
go  
along redeveloping. Problems with backends are common and mostly not  
related  
to nginx as nginx just passes to a backend, anything can go wrong while  
talking to a backend.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,242426,248199#msg-248199](http://forum.nginx.org/read.php?2,242426,248199#msg-248199)

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [March 6, 2014, 6:10pm UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/17 "2014-03-06T18:10:47Z")

</div>

Actually, this may be my issue:

> **[Upstream on Windows 60 second delay](https://forum.nginx.org/read.php?15,239760,239760)**
>
> I've set up nginx (on Windows) as a front end for Tomcat. Accessing the Tomcat webapp works perfectly when I go directly to Tomcat from either Firefox or IE and when I access it from Java code. It also works perfectly the first time I request it from...

Posted at Nginx Forum:

> **[Re: Transforming nginx for Windows](https://forum.nginx.org/read.php?2,242426,248193#msg-248193)**
>
> Working on getting real high performance with nginx under windows I am rewriting code and already got around the fd\_setsize issue following http://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select/18530636 which is...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [March 7, 2014, 10:22am UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/18 "2014-03-07T10:22:26Z")

</div>

## tonyschwartz Wrote:

> There is definitely some issue doing proxying. At some point, the  
> connection to the back end appears to go bad. The request from the  
> browser to nginx just spins and spins. This occurs against (ahem…)  
> IIS6 and also against the Cassini local visual studio development

99% sure this is a backend issue, we’re using it for proxied IIS5/6/7,  
tomcat, java. Fcgi’d php and RoR. The WAF (naxsi) for protecting  
internet  
facing applications, plenty of Lua code provisioning, Lua scaled backend  
load-balancing, authentication, etc…

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,242426,248221#msg-248221](http://forum.nginx.org/read.php?2,242426,248221#msg-248221)

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [March 7, 2014, 12:05am UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/19 "2014-03-07T00:05:33Z")

</div>

There is definitely some issue doing proxying. At some point, the  
connection to the back end appears to go bad. The request from the  
browser  
to nginx just spins and spins. This occurs against (ahem…) IIS6 and  
also  
against the Cassini local visual studio development environment exhibits  
this behavior. I will try this from a linux host to see if I can  
reproduce  
the issue there. The issue I’m experiencing seems to be very much the  
same  
as in the other topic I referenced above.

Posted at Nginx Forum:

> **[Re: Transforming nginx for Windows](https://forum.nginx.org/read.php?2,242426,248207#msg-248207)**
>
> Working on getting real high performance with nginx under windows I am rewriting code and already got around the fd\_setsize issue following http://stackoverflow.com/questions/7976388/increasing-limit-of-fd-setsize-and-select/18530636 which is...

---

<div class="post-metadata">

**Author:** ![itpp2012](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/f05b48/32.png) [@itpp2012](https://www.ruby-forum.com/u/itpp2012)\
**Post date:** [March 7, 2014, 11:19am UTC](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412/20 "2014-03-07T11:19:00Z")

</div>

Hello!

On Thu, Mar 06, 2014 at 06:05:03PM -0500, tonyschwartz wrote:

> There is definitely some issue doing proxying. At some point, the  
> connection to the back end appears to go bad. The request from the browser  
> to nginx just spins and spins. This occurs against (ahem…) IIS6 and also  
> against the Cassini local visual studio development environment exhibits  
> this behavior. I will try this from a linux host to see if I can reproduce  
> the issue there. The issue I’m experiencing seems to be very much the same  
> as in the other topic I referenced above.

The issue in a topic you’ve referenced is wrong address used in  
proxying. See [#496 (Windows upstream 60 proxy\_pass timeout) – nginx](http://trac.nginx.org/nginx/ticket/496) for detailed  
explanation.

–  
Maxim D.

> **[nginx](http://nginx.org/)**

[Next page](https://www.ruby-forum.com/t/transforming-nginx-for-windows/236412.md?page=2)
