# Question about nginx as http forward proxy

**URL:** <https://www.ruby-forum.com/t/question-about-nginx-as-http-forward-proxy/189288>\
**Category:** NGINX\
**Created:** [May 28, 2010, 4:24am UTC](https://www.ruby-forum.com/t/question-about-nginx-as-http-forward-proxy/189288 "2010-05-28T04:24:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roman\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@Roman\_V](https://www.ruby-forum.com/u/Roman_V)\
**Post date:** [May 28, 2010, 4:24am UTC](https://www.ruby-forum.com/t/question-about-nginx-as-http-forward-proxy/189288/1 "2010-05-28T04:24:59Z")

</div>

Hi,

I’m trying to use nginx as forward proxy with high loaded server on  
CentOS 5.4. My stats showing good results (about memory/cpu usage and  
traffic). But Apache benchmark showing some percentage of lagged  
sessions. If I’m using Apache as forward proxy I don’t see this lags.

Can you recommend me some config changes or may be I can boost nginx up  
other way?

# ab -n 1000 -c 5 [http://www.google.com/](http://www.google.com/) Apache: … Connection Times (ms) min mean[+/-sd] median max Connect: 29 43 9.4 40 80 Processing: 120 155 27.7 151 604 Waiting: 61 87 23.2 81 389 Total: 157 197 28.2 192 649 Percentage of the requests served within a certain time (ms) 50% 192 … 99% 277 100% 649 (longest request)

Nginx:  
…  
Connection Times (ms)  
min mean[+/-sd] median max  
Connect: 30 47 164.3 35 3035  
Processing: 110 164 58.1 157 1005  
Waiting: 61 85 37.9 77 604  
Total: 150 211 174.4 196 3226

# Percentage of the requests served within a certain time (ms) 50% 196 … 99% 487 100% 3226 (longest request)

Part of my forward proxy config:  
worker\_processes 32;  
worker\_rlimit\_core 10000000000000000;  
working\_directory /tmp;  
events {  
use epoll;  
worker\_connections 10240;  
multi\_accept on;  
}  
http {  
af\_headers on;  
include mime.types;  
default\_type text/plain;

```
 access_log off;

 sendfile on;
 tcp_nopush off;

 keepalive_timeout 1;
 keepalive_requests 30;

 gzip on;
 gzip_comp_level 6;
 gzip_buffers 16 8k;
 gzip_types text/plain text/css application/json

```

application/x-javascript text/xml application/xml application/xml+rss  
text/javascript;  
gzip\_disable “MSIE [1-6].(?!.\*SV1)”;

```
 resolver 127.0.0.1;

 server {
     location ~ /extern/login_status\.php {
       if ( $host ~* facebook.com ) {
         return 403;
       }
             }

     gzip_proxied any;

     gunzip on;
     gunzip_strict off;
     gunzip_options any content_type 200;

     error_log /etc/nginx/logs/error.log alert;
     listen 7070;
     server_name hss;

     location / {
        proxy_pass http://$host$request_uri;
        proxy_buffering off;
        proxy_buffers 16 64k;
        proxy_buffer_size 64k;
     }
 }

```

}
