# Nginx with PHP - windows performance

**URL:** <https://www.ruby-forum.com/t/nginx-with-php-windows-performance/207822>\
**Category:** NGINX\
**Created:** [June 3, 2011, 1:40pm UTC](https://www.ruby-forum.com/t/nginx-with-php-windows-performance/207822 "2011-06-03T13:40:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [June 3, 2011, 1:40pm UTC](https://www.ruby-forum.com/t/nginx-with-php-windows-performance/207822/1 "2011-06-03T13:40:36Z")

</div>

After 2 days of testing I’m able to run nginx on Windows Vista x64 SP2  
with PHP  
I’m using a Kevin W. 1.04 cygwin build with 2 worker processes  
and 5 child’s of php-cgi.exe  
On a hardware like Laptop with Intel Core2Duo P8400 2.26GHz with 3GB of  
RAM and 250GB 7200 1/min HDD  
I’ve been able to receive results like below:

nginx + PHP  
[Tested locally with Apache Benche - using: ab.exe -n 5000 -c 1000  
127.0.0.1/  
The file reached is index.php with code only \<?php phpinfo(); ?\>]

nginx + php 5.3.6 x86 build thread-safe → 199 requests / sec  
nginx + php 5.3.6 x86 build NON thread-safe → 208 requests / sec  
nginx + php 5.3.6 x64 build thread-safe → 176 requests / sec  
nginx + php 5.3.6 x64 build NON thread-safe → 185 requests / sec

nginx + HTML  
[Tested locally with Apache Benche - using: ab.exe -n 5000 -c 1000  
127.0.0.1/  
The file reached is index.html created by Kevin W.]

nginx with multi\_accept off → 445 requests / sec  
nginx with multi\_accept on → 900 requests / sec

Level of failed requests never was higher than 5 requests.

My nginx.conf  
#user nobody;  
worker\_processes 2;

#error\_log logs/error.log debug;  
#error\_log logs/error.log notice;  
#error\_log logs/error.log error;

pid logs/nginx.pid;

events {  
worker\_connections 2048;

# multi\_accept gives wings but only with HTML - not PHP!!!

multi\_accept off;  
accept\_mutex on;  
}

http {  
include mime.types;  
default\_type application/octet-stream;

```
#log_format main '$remote_addr - $remote_user [$time_local]

```

“$request” ’  
# '$status $body\_bytes\_sent “$http\_referer” ’  
# ‘“$http\_user\_agent” “$http\_x\_forwarded\_for”’;

access\_log off;  
#access\_log logs/access.log main;

```
sendfile on;
#tcp_nopush on;

```

# Enable only on CYGWIN nginx build !!

ssl\_session\_cache shared:SSL:10m;  
ssl\_session\_timeout 5m;

```
keepalive_timeout 30;

```

gzip on;  
gzip\_min\_length 1000;  
gzip\_proxied expired no-cache no-store private auth;  
gzip\_types text/plain application/xml;  
gzip\_disable “MSIE [1-6].”;

# Settings for multiple php-cgi.exe

# 

upstream backend {  
server 127.0.0.1:9000;  
server 127.0.0.1:9001;  
server 127.0.0.1:9002;  
server 127.0.0.1:9003;  
server 127.0.0.1:9004;  
}

```
server {
    listen 80;
listen 443 ssl;
    server_name www.sklep.beta.ostrowwlkp.pl;
ssl_certificate server.crt;
ssl_certificate_key server.key;

    #charset koi8-r;

    #access_log logs/host.access.log main;

    location / {
        root html;
        index index.php;
    }

# Statyczne elementy mogą być cache'owane przez przeglądarkę przez

```

określoną ilość dni [lub max]  
#  
#location ~\* .(ico|css|js|gif|jpe?g|png)$ {  
# expires 30d;  
#}

```
    #error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root html;
    }

    # pass the PHP scripts to FastCGI server listening on

```

127.0.0.1:9000  
#  
location ~ .php$ {  
root html;  
fastcgi\_pass backend;  
#fastcgi\_pass 127.0.0.1:9000;  
fastcgi\_index index.php;  
fastcgi\_param SCRIPT\_FILENAME  
c:/nginx/html/$fastcgi\_script\_name;  
include fastcgi\_params;  
}

```
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    # deny all;
    #}
}

```

}

Any proposition for improvement ???  
Enabling multi\_accept on; with PHP pages is crashing connection.

Posted at Nginx Forum:

> **[nginx with PHP - windows performance](https://forum.nginx.org/read.php?2,203283,203283#msg-203283)**
>
> After 2 days of testing I'm able to run nginx on Windows Vista x64 SP2 with PHP I'm using a Kevin Worthington 1.04 cygwin build with 2 worker processes and 5 child's of php-cgi.exe On a hardware like Laptop with Intel Core2Duo P8400 2.26GHz with 3GB...
