2010年11月30日星期二

Re: error building 0.9.1 on Cygwin

Index: auto/unix
===================================================================
--- auto/unix (revision 3130)
+++ auto/unix (working copy)
@@ -109,6 +109,16 @@
. auto/feature


+ngx_feature="_sys_nerr"
+ngx_feature_name="NGX_SYS_NERR"
+ngx_feature_run=value
+ngx_feature_incs='#include <stdio.h>'
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test='printf("%d", _sys_nerr);'
+. auto/feature
+
+
ngx_feature="sys_nerr"
ngx_feature_name="NGX_SYS_NERR"
ngx_feature_run=value
On Tue, Nov 30, 2010 at 07:22:02PM -0500, Kevin Worthington wrote:

> Got the following error when building in Cygwin on Windows 7 Ultimate.
> Any help is appreciated...
>
> -o objs/src/os/unix/ngx_time.o \
> src/os/unix/ngx_time.c
> gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-functio
> n -Wunused-variable -Wunused-value -Werror -g -D FD_SETSIZE=2048 -I src/core -I
> src/event -I src/event/modules -I src/os/unix -I ~/openssl-0.9.8l/.openssl/inclu
> de -I objs \
> -o objs/src/os/unix/ngx_errno.o \
> src/os/unix/ngx_errno.c
> src/os/unix/ngx_errno.c: In function `ngx_strerror':
> src/os/unix/ngx_errno.c:36: error: `NGX_SYS_NERR' undeclared (first use in this
> function)
> src/os/unix/ngx_errno.c:36: error: (Each undeclared identifier is reported only
> once
> src/os/unix/ngx_errno.c:36: error: for each function it appears in.)
> src/os/unix/ngx_errno.c: In function `ngx_strerror_init':
> src/os/unix/ngx_errno.c:57: error: `NGX_SYS_NERR' undeclared (first use in this
> function)
> make[1]: *** [objs/src/os/unix/ngx_errno.o] Error 1
> make[1]: Leaving directory `/home/kworthington/nginx-0.9.1'
> make: *** [build] Error 2

Try the attached patch.


--
Igor Sysoev
http://sysoev.ru/en/

_wordpress-cache in server name

I saw this example for setting up nginx to run wordpress and wp-super cache

server_name _wordpress-cache mydomain.com;
root /var/www/wordpress_dir;
server_name_in_redirect off;

Can anyone explain to me what the "_wordpress-cache" is doing in the
server name area. Guess I'm trying to wrap my head around new config
options.

Thanks!


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

error building 0.9.1 on Cygwin

Got the following error when building in Cygwin on Windows 7 Ultimate.
Any help is appreciated...

-o objs/src/os/unix/ngx_time.o \
src/os/unix/ngx_time.c
gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-functio
n -Wunused-variable -Wunused-value -Werror -g -D FD_SETSIZE=2048 -I src/core -I
src/event -I src/event/modules -I src/os/unix -I ~/openssl-0.9.8l/.openssl/inclu
de -I objs \
-o objs/src/os/unix/ngx_errno.o \
src/os/unix/ngx_errno.c
src/os/unix/ngx_errno.c: In function `ngx_strerror':
src/os/unix/ngx_errno.c:36: error: `NGX_SYS_NERR' undeclared (first use in this
function)
src/os/unix/ngx_errno.c:36: error: (Each undeclared identifier is reported only
once
src/os/unix/ngx_errno.c:36: error: for each function it appears in.)
src/os/unix/ngx_errno.c: In function `ngx_strerror_init':
src/os/unix/ngx_errno.c:57: error: `NGX_SYS_NERR' undeclared (first use in this
function)
make[1]: *** [objs/src/os/unix/ngx_errno.o] Error 1
make[1]: Leaving directory `/home/kworthington/nginx-0.9.1'
make: *** [build] Error 2

Best regards,
Kevin
--
Kevin Worthington
kworthington@gmail.com

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

5000 connections to backends in TIME_WAIT state, nginx grows and starts swapping

Hi,

nginx version: nginx/0.7.67
TLS SNI support enabled
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I
/usr/local/include' --with-ld-opt='-L /usr/local/lib'
--conf-path=/usr/local/etc/nginx/nginx.conf
--sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid
--error-log-path=/var/log/nginx-error.log --user=www --group=www
--http-client-body-temp-path=/var/tmp/nginx/client_body_temp
--http-proxy-temp-path=/var/tmp/nginx/proxy_temp
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp
--http-log-path=/var/log/nginx-access.log
--with-http_gzip_static_module --with-http_ssl_module
--with-http_stub_status_module
--add-module=/usr/ports/www/nginx/work/nginx_upstream_fair-20090923
--add-module=/usr/ports/www/nginx/work/nginx_upstream_hash-0.3.1
--with-pcre

I have two freebsd 8.0 servers using carp, nginx listens on the carp
interface on both for high availability.

What I am seeing is that nginx opens 5,000 connections to the
preferred back end. I have a backup back end declared, but prefer one.
This causes nginx to grow in size, use a lot of swap, and die.

I've mitigated this by setting net.inet.tcp.keepidle=300000 on
freebsd. The connections go away after 5 minutes.

It's a pretty simple nginx.conf I use, and I'm not sure why I'm
getting this behaviour. Should I simply upgrade my nginx to latest?

Thoughts appreciated.


---


Stefan Caunter
cell: 416 561 4871
Skype: stefan.caunter

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: specifying additional mime types

On 11/30/2010 10:18 AM, Igor Sysoev wrote:
> On Tue, Nov 30, 2010 at 09:54:38AM -0300, Juan Fco. Giordana wrote:
>> Hi Igor,
>>
>> Can you add: "audio/ogg ogg;" to the list?
>
> Done.

Thanks.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: specifying additional mime types

On Tue, Nov 30, 2010 at 09:54:38AM -0300, Juan Fco. Giordana wrote:

> On 11/30/2010 06:43 AM, Igor Sysoev wrote:
> > On Tue, Nov 30, 2010 at 01:48:59AM -0500, masterkain wrote:
> >
> > You should add them in mime.types.
>
> Hi Igor,
>
> Can you add: "audio/ogg ogg;" to the list?

Done.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

nginx-0.9.1

Changes with nginx 0.9.1 30 Nov 2010

*) Bugfix: "return CODE message" directives did not work; the bug had
appeared in 0.9.0.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: specifying additional mime types

On 11/30/2010 06:43 AM, Igor Sysoev wrote:
> On Tue, Nov 30, 2010 at 01:48:59AM -0500, masterkain wrote:
>
> You should add them in mime.types.

Hi Igor,

Can you add: "audio/ogg ogg;" to the list?

Thanks

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: specifying additional mime types

On Tue, Nov 30, 2010 at 01:48:59AM -0500, masterkain wrote:

> Hello,
> I'm currently including the default table on mime types: include
> mime.types;
>
> I would like to add two additional mime types not included in this list,
> I should edit the file directly (which I dislike) or can I add another
> types {} block in nginx.conf directly and they will be merged?

You should add them in mime.types.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Citrix secure gateway and nginx

I think, you should use haproxy for this.

2010 11 29 23:16 пользователь "Danny Trinh" <danny.d.trinh@gmail.com> написал:
> Hi group,
> Does anyone use nginx as reverse proxy on front of Citrix secure gateway
> (CSG)?
>
> Basically, the path will go like this internet <--> nginx <--> firewall <-->
> CSG
> I know CSG will use ports 443. 80. 1494, but not quite sure how thing works
> yet. I'm really appreciated if you give me some guide light on how to setup
> nginx for this solution.
> Thanks,
>
> --
> Danny Trinh
> Linux Admin

2010年11月29日星期一

specifying additional mime types

Hello,
I'm currently including the default table on mime types: include
mime.types;

I would like to add two additional mime types not included in this list,
I should edit the file directly (which I dislike) or can I add another
types {} block in nginx.conf directly and they will be merged?

Thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,154321,154321#msg-154321


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx-0.9.0

Nuno Magalhães at 2010-11-30 12:09 wrote:
> On Tue, Nov 30, 2010 at 02:52, Weibin Yao <nbubingo@gmail.com> wrote:
>
>> The source code of 0.9.0 does not appear in the download page:
>> http://nginx.org/en/download.html
>>
>> But the URL is ok: http://nginx.org/download/nginx-0.9.0.tar.gz
>>
>
> What do you mean "source code"? The link to the tarball is the first
> one, under "development versions", right in front of "CHANGES".
>
Oh, my fault, just ignore it. This page is cached in my browser.

--
Weibin Yao


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx-0.9.0

On Tue, Nov 30, 2010 at 02:52, Weibin Yao <nbubingo@gmail.com> wrote:
> The source code of 0.9.0 does not appear in the download page:
> http://nginx.org/en/download.html
>
> But the URL is ok: http://nginx.org/download/nginx-0.9.0.tar.gz

What do you mean "source code"? The link to the tarball is the first
one, under "development versions", right in front of "CHANGES".

--
Mars 2 Stay!
http://xkcd.com/801/
/etc

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx-0.9.0

Igor Sysoev at 2010-11-29 23:36 wrote:
> Changes with nginx 0.9.0 29 Nov 2010
>
> *) Feature: the "keepalive_disable" directive.
>
> *) Feature: the "map" directive supports variables as value of a
> defined variable.
>
> *) Feature: the "map" directive supports empty strings as value of the
> first parameter.
>
> *) Feature: the "map" directive supports expressions as the first
> parameter.
>
> *) Feature: nginx(8) manual page.
> Thanks to Sergey Osokin.
>
> *) Feature: Linux accept4() support.
> Thanks to Simon Liu.
>
> *) Workaround: elimination of Linux linker warning about "sys_errlist"
> and "sys_nerr"; the warning had appeared in 0.8.35.
>
> *) Bugfix: a segmentation fault might occur in a worker process, if the
> "auth_basic" directive was used.
> Thanks to Michail Laletin.
>
> *) Bugfix: compatibility with ngx_http_eval_module; the bug had
> appeared in 0.8.42.
>
>
>
The source code of 0.9.0 does not appear in the download page:
http://nginx.org/en/download.html

But the URL is ok: http://nginx.org/download/nginx-0.9.0.tar.gz

--
Weibin Yao


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Need a helping hand setting up ssl server on local box

On Mon, Nov 29, 2010 at 4:37 PM, Maxim Dounin <mdounin@mdounin.ru> wrote:
> Hello!
>
> On Mon, Nov 29, 2010 at 02:19:50PM +0100, Saimon Moore wrote:
>
>> Hi Maxim,
>>
>> I did and there's nothing (new) in there... :(
>
> So the most likely reason is that you forgot to reload nginx
> config.  It should complain there why it wasn't able to parse your
> config and/or open configured listening sockets.  Even if you were
> smart enough to redirect stderr to something like /dev/null.

As expected my bad. Sorry for the noise.
You were on the right track. I had two configs setup in
sites-available. The one I was interested in wasn't symlinked in
sites-enabled. duh.

Thanks again...

>
> Another possible reason is that you have wrong binary running and
> it tries to read configs from another place.
>
> Full restart should resolve both mentioned issues.
>
> Maxim Dounin
>
> p.s. Please do not top-post.  Thank you.
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx
>

--
Saimon Moore
Freelance Web Developer
(Available for hire - For details visit http://saimonmoore.net)

Skype: saimonmoore
Yahoo IM: saimonmoore
Google IM: saimonmoore

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: upstream fast_cgi no port error

On 11/28/10 19:36, Phil Bayfield wrote:
> You shouldn't need to use an upstream for fast cgi, something like this
> would work:
>
> fastcgi_pass localhost:1234;

Yes of course. However upstream is supposed to work as well and, for me at
least, it doesn't seem to.

If somebody could corroborate my observation then I'd feel more confident
logging it as a bug.

Dick

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx-0.9.0

On Mon, Nov 29, 2010 at 11:55:39AM -0800, Cliff Wells wrote:

> On Mon, 2010-11-29 at 18:36 +0300, Igor Sysoev wrote:
> > *) Bugfix: compatibility with ngx_http_eval_module; the bug had
> > appeared in 0.8.42.
>
> Hi Igor,
>
> Can you elaborate a bit on what this issue was? I know there was an
> issue introduced around this same time that affected some other 3rd
> party modules having to do with filters no longer receiving NGX_AGAIN or
> something (my memory on this is vague).

Modules those work in rewrite phase now should return NGX_DONE instead of
NGX_AGAIN. Before 0.8.42 NGX_DONE did the same as NGX_AGAIN. Since 0.8.42
NGX_AGAIN is processed in a different way.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Citrix secure gateway and nginx

Hi group,
Does anyone use nginx as reverse proxy on front of Citrix secure gateway (CSG)?

Basically, the path will go like this internet <--> nginx <--> firewall <--> CSG
I know CSG will use ports 443. 80. 1494, but not quite sure how thing works yet. I'm really appreciated if you give me some guide light on how to setup nginx for this solution.
Thanks,

--
Danny Trinh
Linux Admin

Re: nginx-0.9.0



On Tue, Nov 30, 2010 at 3:40 AM, Igor Sysoev <igor@sysoev.ru> wrote:
On Tue, Nov 30, 2010 at 12:39:17AM +0800, David Yu wrote:

> On Mon, Nov 29, 2010 at 11:36 PM, Igor Sysoev <igor@sysoev.ru> wrote:
>
> > Changes with nginx 0.9.0                                         29 Nov
> > 2010
> >
> >    *) Feature: the "keepalive_disable" directive.
> >
> >    *) Feature: the "map" directive supports variables as value of a
> >       defined variable.

map $one      $two {
   default   $three;    # $three
   1         $four;     # $four
   ...
}

> >    *) Feature: the "map" directive supports empty strings as value of the
> >       first parameter.

map $one      $two {
   ""        none;     # ""
   ...
}

> >    *) Feature: the "map" directive supports expressions as the first
> >       parameter.

map "$one$some"  $two {
   ...
}

Thanks! 

> Are there any examples using the new map features? (couldn't find it in
> http://wiki.nginx.org/HttpMapModule).


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx



--
When the cat is away, the mouse is alone.
- David Yu

Re: nginx-0.9.0

On Mon, 2010-11-29 at 18:36 +0300, Igor Sysoev wrote:
> *) Bugfix: compatibility with ngx_http_eval_module; the bug had
> appeared in 0.8.42.

Hi Igor,

Can you elaborate a bit on what this issue was? I know there was an
issue introduced around this same time that affected some other 3rd
party modules having to do with filters no longer receiving NGX_AGAIN or
something (my memory on this is vague).

Regards,
Cliff

--
Cliff Wells <cliff@develix.com>


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx-0.9.0

On Tue, Nov 30, 2010 at 12:39:17AM +0800, David Yu wrote:

> On Mon, Nov 29, 2010 at 11:36 PM, Igor Sysoev <igor@sysoev.ru> wrote:
>
> > Changes with nginx 0.9.0 29 Nov
> > 2010
> >
> > *) Feature: the "keepalive_disable" directive.
> >
> > *) Feature: the "map" directive supports variables as value of a
> > defined variable.

map $one $two {
default $three; # $three
1 $four; # $four
...
}

> > *) Feature: the "map" directive supports empty strings as value of the
> > first parameter.

map $one $two {
"" none; # ""
...
}

> > *) Feature: the "map" directive supports expressions as the first
> > parameter.

map "$one$some" $two {
...
}

> Are there any examples using the new map features? (couldn't find it in
> http://wiki.nginx.org/HttpMapModule).


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx-0.9.0

seems like zlib problem on slow connection still exists,
may be better to include Maxim's FIX it in current version?
I found discussion in online archive, patch is there.

http://forum.nginx.org/read.php?2,151781


On 11/29/2010 07:36 AM, Igor Sysoev wrote:
> Changes with nginx 0.9.0 29 Nov 2010
>
> *) Feature: the "keepalive_disable" directive.
>
> *) Feature: the "map" directive supports variables as value of a
> defined variable.
>
> *) Feature: the "map" directive supports empty strings as value of the
> first parameter.
>
> *) Feature: the "map" directive supports expressions as the first
> parameter.
>
> *) Feature: nginx(8) manual page.
> Thanks to Sergey Osokin.
>
> *) Feature: Linux accept4() support.
> Thanks to Simon Liu.
>
> *) Workaround: elimination of Linux linker warning about "sys_errlist"
> and "sys_nerr"; the warning had appeared in 0.8.35.
>
> *) Bugfix: a segmentation fault might occur in a worker process, if the
> "auth_basic" directive was used.
> Thanks to Michail Laletin.
>
> *) Bugfix: compatibility with ngx_http_eval_module; the bug had
> appeared in 0.8.42.
>
>
>


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx-0.9.0



On Mon, Nov 29, 2010 at 11:36 PM, Igor Sysoev <igor@sysoev.ru> wrote:
Changes with nginx 0.9.0                                         29 Nov 2010

   *) Feature: the "keepalive_disable" directive.

   *) Feature: the "map" directive supports variables as value of a
      defined variable.

   *) Feature: the "map" directive supports empty strings as value of the
      first parameter.

   *) Feature: the "map" directive supports expressions as the first
      parameter.
Are there any examples using the new map features? (couldn't find it in http://wiki.nginx.org/HttpMapModule).
Thanks!
 

   *) Feature: nginx(8) manual page.
      Thanks to Sergey Osokin.

   *) Feature: Linux accept4() support.
      Thanks to Simon Liu.

   *) Workaround: elimination of Linux linker warning about "sys_errlist"
      and "sys_nerr"; the warning had appeared in 0.8.35.

   *) Bugfix: a segmentation fault might occur in a worker process, if the
      "auth_basic" directive was used.
      Thanks to Michail Laletin.

   *) Bugfix: compatibility with ngx_http_eval_module; the bug had
      appeared in 0.8.42.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx



--
When the cat is away, the mouse is alone.
- David Yu

Re: Need a helping hand setting up ssl server on local box

Hello!

On Mon, Nov 29, 2010 at 02:19:50PM +0100, Saimon Moore wrote:

> Hi Maxim,
>
> I did and there's nothing (new) in there... :(

So the most likely reason is that you forgot to reload nginx
config. It should complain there why it wasn't able to parse your
config and/or open configured listening sockets. Even if you were
smart enough to redirect stderr to something like /dev/null.

Another possible reason is that you have wrong binary running and
it tries to read configs from another place.

Full restart should resolve both mentioned issues.

Maxim Dounin

p.s. Please do not top-post. Thank you.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

nginx-0.9.0

Changes with nginx 0.9.0 29 Nov 2010

*) Feature: the "keepalive_disable" directive.

*) Feature: the "map" directive supports variables as value of a
defined variable.

*) Feature: the "map" directive supports empty strings as value of the
first parameter.

*) Feature: the "map" directive supports expressions as the first
parameter.

*) Feature: nginx(8) manual page.
Thanks to Sergey Osokin.

*) Feature: Linux accept4() support.
Thanks to Simon Liu.

*) Workaround: elimination of Linux linker warning about "sys_errlist"
and "sys_nerr"; the warning had appeared in 0.8.35.

*) Bugfix: a segmentation fault might occur in a worker process, if the
"auth_basic" directive was used.
Thanks to Michail Laletin.

*) Bugfix: compatibility with ngx_http_eval_module; the bug had
appeared in 0.8.42.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Need a helping hand setting up ssl server on local box

Can some please take a quick look at my nginx config to see if there's
anything obviously wrong I may be missing? I've been trying different
variations of the same thing but I'm still not able to get ssl working
on my local osx box.

On Mon, Nov 29, 2010 at 2:19 PM, Saimon Moore <saimonmoore@gmail.com> wrote:
> Hi Maxim,
>
> I did and there's nothing (new) in there... :(
>
> On Mon, Nov 29, 2010 at 1:25 PM, Maxim Dounin <mdounin@mdounin.ru> wrote:
>> Hello!
>>
>> On Mon, Nov 29, 2010 at 12:45:50PM +0100, Saimon Moore wrote:
>>
>>> Here is my setup (detailed): https://gist.github.com/719862
>>>
>>> I can access the port 80 server but not port 443.
>>>
>>> I get Error 102 (net::ERR_CONNECTION_REFUSED): Unknown error. in chrome.
>>>
>>> Another strange issue is the log files for either the port 80 or 443
>>> server don't appear where I told them to go in the config. (There are
>>> error and access logs in the homebrew nginx location but nothing of
>>> value in there.
>>>
>>> Struggling right now to figure out what I'm doing wrong...
>>>
>>> I'd appreciate any help...
>>
>> Try looking into global error log, it should be in
>> /usr/local/Cellar/nginx/0.8.53/logs/error.log with your setup.
>>
>> Maxim Dounin
>>
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> http://nginx.org/mailman/listinfo/nginx
>>
>
>
>
> --
> Saimon Moore
> Freelance Web Developer
> (Available for hire - For details visit http://saimonmoore.net)
>
> Skype: saimonmoore
> Yahoo IM: saimonmoore
> Google IM: saimonmoore
>

--
Saimon Moore
Freelance Web Developer
(Available for hire - For details visit http://saimonmoore.net)

Skype: saimonmoore
Yahoo IM: saimonmoore
Google IM: saimonmoore

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

reverse proxy https->http and resource/connection protection

Hello nginx users,

Like to have one IP with reverse proxy (https->http) site,
using wildchard certificates (multiple virtual hosts on one IP and
using different upstreams for different subdomains.

Currently implemented in a testcase like:

location / {
if ($http_host = urla.domain.com ) {
proxy_pass http://urla.domain;
break;
}

if ($http_host = urlb.domain.com ) {
proxy_pass http://urlb.domain.com;
break;
}

}

and works fine (functional) not tested in production yet.

Using different upstreams i'm worried if one upstream fails or might get
overloaded in a terrible way (say urla), the other upstream (say urlb)
wil eventualy fail as wel, as nginx may use up all it's resources for the problem upstream.

For that i'd like to limit the max connections on a subdomain, and i'm
not seeing yet how to do that.
I can limit the complete server {} definition using limit_conn for
example, but that doesn't exacly cover this case.

How would one do that? splitting the servers definition, and using up
extra IP's ?

Thanks in advance,

Regards,

--
Arjan Filius
mailto:iafilius@xs4all.nl

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: NGINX config multi site Image are not displaying on Sub domains

Got it

rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
if (!-e $request_filename) {

Instead !!!!

Sincerely,

--
Posted via http://www.ruby-forum.com/.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Need a helping hand setting up ssl server on local box

Hi Maxim,

I did and there's nothing (new) in there... :(

On Mon, Nov 29, 2010 at 1:25 PM, Maxim Dounin <mdounin@mdounin.ru> wrote:
> Hello!
>
> On Mon, Nov 29, 2010 at 12:45:50PM +0100, Saimon Moore wrote:
>
>> Here is my setup (detailed): https://gist.github.com/719862
>>
>> I can access the port 80 server but not port 443.
>>
>> I get Error 102 (net::ERR_CONNECTION_REFUSED): Unknown error. in chrome.
>>
>> Another strange issue is the log files for either the port 80 or 443
>> server don't appear where I told them to go in the config. (There are
>> error and access logs in the homebrew nginx location but nothing of
>> value in there.
>>
>> Struggling right now to figure out what I'm doing wrong...
>>
>> I'd appreciate any help...
>
> Try looking into global error log, it should be in
> /usr/local/Cellar/nginx/0.8.53/logs/error.log with your setup.
>
> Maxim Dounin
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx
>

--
Saimon Moore
Freelance Web Developer
(Available for hire - For details visit http://saimonmoore.net)

Skype: saimonmoore
Yahoo IM: saimonmoore
Google IM: saimonmoore

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: NGINX config multi site Image are not displaying on Sub domains

I am sorry so what would be my solution for this problem what would be
the correct configuration

All of the images located in the
++blogs.dir++ each newly created blog is assign a number >

I have just checked the direct link
http://subdomain.main.com/wp-content/blogs.dir/135/files/2010/11/file11.jpg
image displaying so it is some were in the path.

How would I rewrite this or else what would be the rational decision for
that config.

Sincerely,

--
Posted via http://www.ruby-forum.com/.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Variable dobts:- Do I need to hard code values ($host, $rmote_addr , $proxy_add_x_forwarded)

Hi
  I am trying to configure nginx for reverse proxy,my intention is to have load balancing, On 192.168.20.59(CentOS) I have nginx installed. I have two machines(192.168.20.59 and 192.168.20.208) running IIS.

My Test environment is as shown in the map


       |
=============                              |---- rac1.mydomain.com
| LAN        |                              |       192.168.20.59
=============                              |---- rac2.mydomain.com
       |                                    |      192.168.20.208
       |                                    |
       |      |eth0 -> 192.168.20.34 ------/
       |-lb0==|                           /
       |      |eth1 -> 192.168.20.44 ----/
       |      | eth1=virtual IP address
       |
       |
=================                             
|LAN Connection |                             
=================         

I am referening book "Nginx HTTP server ", Chapter 7 + other related  google search results. I have doubt in the variable setting, do we need to hard code the value of does the program take it from any other parameters.
My doubts are how I am getting values for $host, $rmote_addr , $proxy_add_x_forwarded_for(part of configuration files I have cut and pasted); Do I need to give the real IP address itself instead of the varibales ($host, $rmote_addr , $proxy_add_x_forwarded) in the configuration file

## PROXY - Web
      location / {
        proxy_pass  http://127.0.0.1:80;
        #proxy_pass  http://192.168.20.34:80;
        proxy_cache            cache;
        proxy_cache_valid      200 24h;
        proxy_cache_use_stale  error timeout invalid_header updating http_500 http_502 http_503 http_504;
        proxy_ignore_headers   Expires Cache-Control;

        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      }
##############
Please advice me
Thanks
  Joseph John


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Need a helping hand setting up ssl server on local box

Hello!

On Mon, Nov 29, 2010 at 12:45:50PM +0100, Saimon Moore wrote:

> Here is my setup (detailed): https://gist.github.com/719862
>
> I can access the port 80 server but not port 443.
>
> I get Error 102 (net::ERR_CONNECTION_REFUSED): Unknown error. in chrome.
>
> Another strange issue is the log files for either the port 80 or 443
> server don't appear where I told them to go in the config. (There are
> error and access logs in the homebrew nginx location but nothing of
> value in there.
>
> Struggling right now to figure out what I'm doing wrong...
>
> I'd appreciate any help...

Try looking into global error log, it should be in
/usr/local/Cellar/nginx/0.8.53/logs/error.log with your setup.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: NGINX config multi site Image are not displaying on Sub domains

Hello!

On Mon, Nov 29, 2010 at 09:56:52AM +0100, Alex Kolobok wrote:

> I don't know is the is anybody who can help me I need an expert advice
> or somebody who encountered this problem. Here is a problem can't figer
> out what is the problem with my set up.
>
> Problem@@@_______________________________________________________________
>
> Images on sub domains are not displaying properly the main domain images
> are working.
> I don't know if the is an options in wp I am not awere of or it is my
> setup
> ___________________________________________________________________________
> Below are my nginx config

[...]

> ## Images and static content is treated different
> location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
> access_log off;
> expires 30d;
> root /var/www/mysite;
> }

You explicitly instructed nginx to look for images (and other
static files) under /var/www/mysite. There is no surprise it does
what you said to.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Possible bug? Redirect 301 to 1st hostname in server_name list

On 29 November 2010 13:15, Boris Dolgov <boris@dolgov.name> wrote:
>> following config. host1 and host2 currently point to another server
>> (DNS), so host3 is used for testing. When requesting host3/drupal
>> nginx sends http 301 and the browser is redirected to host1/drupal
>> (which is on another server). If I place host3 1st in the list, then
>> everything works fine? Is this an nginx bug, or a config issue? If the
>> latter, how should I configure nginx so that drupal behaves
>> identically for all server_name's?
> This is a config issue - use server_name_in_redirect off;

Thank you. I see it's on the wiki too - I should've found that! Much
appreciated.

http://wiki.nginx.org/HttpCoreModule#server_name_in_redirect

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Need a helping hand setting up ssl server on local box

Here is my setup (detailed): https://gist.github.com/719862

I can access the port 80 server but not port 443.

I get Error 102 (net::ERR_CONNECTION_REFUSED): Unknown error. in chrome.

Another strange issue is the log files for either the port 80 or 443
server don't appear where I told them to go in the config. (There are
error and access logs in the homebrew nginx location but nothing of
value in there.

Struggling right now to figure out what I'm doing wrong...

I'd appreciate any help...

Regards,

Saimon

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Possible bug? Redirect 301 to 1st hostname in server_name list

On Mon, Nov 29, 2010 at 13:14, Dale Gallagher <dale.gallagher@gmail.com> wrote:
> Hi there
>
> We're running nginx 0.7.67 and PHP 5.2.14 for a virtual host, with the
> following config. host1 and host2 currently point to another server
> (DNS), so host3 is used for testing. When requesting host3/drupal
> nginx sends http 301 and the browser is redirected to host1/drupal
> (which is on another server). If I place host3 1st in the list, then
> everything works fine? Is this an nginx bug, or a config issue? If the
> latter, how should I configure nginx so that drupal behaves
> identically for all server_name's?
This is a config issue - use server_name_in_redirect off;


--
Boris Dolgov.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Possible bug? Redirect 301 to 1st hostname in server_name list

Hi there

We're running nginx 0.7.67 and PHP 5.2.14 for a virtual host, with the
following config. host1 and host2 currently point to another server
(DNS), so host3 is used for testing. When requesting host3/drupal
nginx sends http 301 and the browser is redirected to host1/drupal
(which is on another server). If I place host3 1st in the list, then
everything works fine? Is this an nginx bug, or a config issue? If the
latter, how should I configure nginx so that drupal behaves
identically for all server_name's?

server {
listen 80;
server_name host1 host2 host3;
root /srv/web/host1/public;
access_log /srv/web/host1/log/access.log combined;

location / {
index.html index.php;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 break;
}
error_page 404 /index.php

location ~ \.php$ {
fastcgi_pass unix:/srv/web/host1/sock/php.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Thanks
Dale

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

nginx_http_push_module subscriber leaving

Hi, 

I am Zeeshan. I am going to use nginx_http_push_module for one of my webservices. It's a live visitors feed service, which tells the visitors of a site who else is visiting the site at the same time in real time. So the model is that every url is a channel and visitors on a page subscribes to the channel for that page and start getting the feed whenever a new visitor arrives. So far it's simple and i have figured out how to do it using nginx_http_push_module. 

What I am unable to figure out is that visitors close the page/browser to leave the channel. How to know that a subscriber has left the channel and broadcast his departure to all the subscribers?

Any help would be really appreciated.

Thanks,
Zeeshan

NGINX config multi site Image are not displaying on Sub domains

I don't know is the is anybody who can help me I need an expert advice
or somebody who encountered this problem. Here is a problem can't figer
out what is the problem with my set up.

Problem@@@_______________________________________________________________

Images on sub domains are not displaying properly the main domain images
are working.
I don't know if the is an options in wp I am not awere of or it is my
setup
___________________________________________________________________________
Below are my nginx config

RUNNING NGINX+FASTCGI ON DEBIAN.
_

server{
server_name *.mysite.com mysite.com http://www.mysite.com;
listen 80;
#on server block
##necessary if using a multi-site plugin
server_name_in_redirect off;
##necessary if running Nginx behind a reverse-proxy
port_in_redirect off;
access_log /var/log/nginx/localhost.access.log;

location / {
root /var/www/mysite;
index index.html index.htm index.php;
# if the requested file exists, return it immediately
if (-f $request_filename) {
break;
}

## W3 Total CACHE BEGIN
set $totalcache_file '';
set $totalcache_uri $request_uri;

if ($request_method = POST) {
set $totalcache_uri '';
}

# Using pretty permalinks, so bypass the cache for any query string
if ($query_string) {
set $totalcache_uri '';
}

if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
set $totalcache_uri '';
}

# if we haven't bypassed the cache, specify our totalcache file
if ($totalcache_uri ~ ^(.+)$) {
set $totalcache_file /wp-content/w3tc-$http_host/pgcache/$1/_index.html;
}

# only rewrite to the totalcache file if it actually exists
if (-f $document_root$totalcache_file) {
rewrite ^(.*)$ $totalcache_file break;
}

##W3 Total CACHE END
# all other requests go to WordPress
if (!-e $request_filename) {
rewrite . /index.php last;
}
}

## Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 30d;
root /var/www/mysite;
}

location ~ .php$ {
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/mysite$fastcgi_script_name;
}
}
___________________________________________________________________

Everything else is default
http://subdomain.main.com/files/2010/11/5537445.jpg
Links to images are as follows
and blogs.dir folder

I think the is a error in my

location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 30d;
root /var/www/mysite;
}

If anybody have a solution it will be really appreciated.

--
Posted via http://www.ruby-forum.com/.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

[ANNOUNCE]nginx_limit_access_module - support to deny request by specific variable

Hi folks,

I develop a module which can deny request by specific variable. The
module's URL is: https://github.com/yaoweibin/nginx_limit_access_module

A simple deny ip example:
http {

limit_access_zone zone=one:5m bucket_number=10007 type=ip;

server {
listen 80;
server_name localhost;

limit_access_variable zone=one $limit_access_deny;

location / {
root html;
index index.html index.htm;

if ($limit_access_deny) {
return 403;
}
}

location /limit_interface {
allow 192.168.1.0/24;
deny all;
limit_access_interface zone=one;
}
}
}

The request method sent to the interface location is POST, and the
content-type is application/x-www-form-urlencoded. The content is like this:

ban_type=ip&ban_expire=3600&ban_list=192.168.1.1,192.168.1.2

And then the requests from 192.168.1.1 and 192.168.1.2 are banned in
3600 seconds.

--
Weibin Yao

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: IPv6 addresses for host name are incorrectly trimmed by nginx

On 29 November 2010 01:15, Maxim Dounin <mdounin@mdounin.ru> wrote:
Hello!

On Sun, Nov 28, 2010 at 07:19:17PM +0000, Phil Bayfield wrote:

> I'm trying to test IPv6 on a couple of sites and I seem to have encountered
> a bug with nginx.
>
> I have 2 backend servers behind a proxy, all servers run nginx 0.8.53.
>
> If I enter the IPv6 address into the browser, the address is trimmed when it
> reaches the backend server.
>
> Here is an example using PHP:
>
> Direct request to backend server (works):
>
> http://[2a02:40:40:7::3]/test.php
> $_SERVER['HTTP_HOST'] = [2a02:40:40:7::3]
>
> Via proxy:
>
> http://[2a02:40:40:7::7]/test.php
> $_SERVER['HTTP_HOST'] = [2a02:40:40:7:

Known issue, ipv6 address literals not supported.

http://nginx.org/pipermail/nginx/2010-November/023652.html

 
Thanks for the info, will have to hope that someone has time to fix it at some point!
Unfortunately the only way to test via a 6to4 tunnel on an IPv4 connection is to use the full IPv6 address.

2010年11月28日星期日

Re: IPv6 addresses for host name are incorrectly trimmed by nginx

Hello!

On Sun, Nov 28, 2010 at 07:19:17PM +0000, Phil Bayfield wrote:

> I'm trying to test IPv6 on a couple of sites and I seem to have encountered
> a bug with nginx.
>
> I have 2 backend servers behind a proxy, all servers run nginx 0.8.53.
>
> If I enter the IPv6 address into the browser, the address is trimmed when it
> reaches the backend server.
>
> Here is an example using PHP:
>
> Direct request to backend server (works):
>
> http://[2a02:40:40:7::3]/test.php
> $_SERVER['HTTP_HOST'] = [2a02:40:40:7::3]
>
> Via proxy:
>
> http://[2a02:40:40:7::7]/test.php
> $_SERVER['HTTP_HOST'] = [2a02:40:40:7:

Known issue, ipv6 address literals not supported.

http://nginx.org/pipermail/nginx/2010-November/023652.html

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: IPv6 addresses for host name are incorrectly trimmed by nginx

Here is debug output showing the problem:

2010/11/28 21:22:37 [debug] 10417#0: accept on [2a02:40:40:7::7]:80, ready: 0
2010/11/28 21:22:37 [debug] 10417#0: posix_memalign: 0000000001031DA0:256 @16
2010/11/28 21:22:37 [debug] 10417#0: *8 accept: 2001:0:5ef5:79fd:3472:2f12:921f:6666 fd:3
2010/11/28 21:22:37 [debug] 10417#0: *8 event timer add: 3: 60000:1290979417739
2010/11/28 21:22:37 [debug] 10417#0: *8 epoll add event: fd:3 op:1 ev:80000001
2010/11/28 21:22:37 [debug] 10417#0: *8 posix_memalign: 0000000001063DD0:256 @16
2010/11/28 21:22:37 [debug] 10417#0: *8 malloc: 000000000103FB90:1288
2010/11/28 21:22:37 [debug] 10417#0: *8 malloc: 00000000010400A0:1024
2010/11/28 21:22:37 [debug] 10417#0: *8 posix_memalign: 00000000010404B0:4096 @16
2010/11/28 21:22:37 [debug] 10417#0: *8 http process request line
2010/11/28 21:22:37 [debug] 10417#0: *8 recv: fd:3 644 of 1024
2010/11/28 21:22:37 [debug] 10417#0: *8 http request line: "GET / HTTP/1.1"
2010/11/28 21:22:37 [debug] 10417#0: *8 http uri: "/"
2010/11/28 21:22:37 [debug] 10417#0: *8 http args: ""
2010/11/28 21:22:37 [debug] 10417#0: *8 http exten: ""
2010/11/28 21:22:37 [debug] 10417#0: *8 http process request header line
2010/11/28 21:22:37 [debug] 10417#0: *8 http header: "Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"
2010/11/28 21:22:37 [debug] 10417#0: *8 http header: "Accept-Language: en-GB"
2010/11/28 21:22:37 [debug] 10417#0: *8 http header: "User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET CLR 1.1.4322; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; .NET4.0C; Creative AutoUpdate v1.40.02)"
2010/11/28 21:22:37 [debug] 10417#0: *8 http header: "Accept-Encoding: gzip, deflate"
2010/11/28 21:22:37 [debug] 10417#0: *8 http header: "Host: [2a02:40:40:7::7]"
2010/11/28 21:22:37 [debug] 10417#0: *8 http header: "Connection: Keep-Alive"
2010/11/28 21:22:37 [debug] 10417#0: *8 http header done
2010/11/28 21:22:37 [debug] 10417#0: *8 event timer del: 3: 1290979417739
2010/11/28 21:22:37 [debug] 10417#0: *8 generic phase: 0
2010/11/28 21:22:37 [debug] 10417#0: *8 rewrite phase: 1
2010/11/28 21:22:37 [debug] 10417#0: *8 test location: "/"
2010/11/28 21:22:37 [debug] 10417#0: *8 using configuration "/"
2010/11/28 21:22:37 [debug] 10417#0: *8 http cl:-1 max:1048576
2010/11/28 21:22:37 [debug] 10417#0: *8 rewrite phase: 3
2010/11/28 21:22:37 [debug] 10417#0: *8 post rewrite phase: 4
2010/11/28 21:22:37 [debug] 10417#0: *8 generic phase: 5
2010/11/28 21:22:37 [debug] 10417#0: *8 generic phase: 6
2010/11/28 21:22:37 [debug] 10417#0: *8 generic phase: 7
2010/11/28 21:22:37 [debug] 10417#0: *8 access phase: 8
2010/11/28 21:22:37 [debug] 10417#0: *8 access phase: 9
2010/11/28 21:22:37 [debug] 10417#0: *8 post access phase: 10
2010/11/28 21:22:37 [debug] 10417#0: *8 http init upstream, client timer: 0
2010/11/28 21:22:37 [debug] 10417#0: *8 epoll add event: fd:3 op:3 ev:80000005
2010/11/28 21:22:37 [debug] 10417#0: *8 posix_memalign: 0000000001036860:4096 @16
2010/11/28 21:22:37 [debug] 10417#0: *8 http script copy: "Host: "
2010/11/28 21:22:37 [debug] 10417#0: *8 http script var: "[2a02:40:40:7:"
2010/11/28 21:22:37 [debug] 10417#0: *8 http script copy: "
2010/11/28 21:22:37 [debug] 10417#0: *8 http script copy: "X-Real-IP: "
2010/11/28 21:22:37 [debug] 10417#0: *8 http script var: "2001:0:5ef5:79fd:3472:2f12:921f:6666"
2010/11/28 21:22:37 [debug] 10417#0: *8 http script copy: "
2010/11/28 21:22:37 [debug] 10417#0: *8 http script copy: "X-Forwarded-For: "
2010/11/28 21:22:37 [debug] 10417#0: *8 http script var: "2001:0:5ef5:79fd:3472:2f12:921f:6666"
2010/11/28 21:22:37 [debug] 10417#0: *8 http script copy: "
2010/11/28 21:22:37 [debug] 10417#0: *8 http script copy: "Connection: close

Re: upstream fast_cgi no port error

You shouldn't need to use an upstream for fast cgi, something like this would work:

fastcgi_pass localhost:1234;

IPv6 addresses for host name are incorrectly trimmed by nginx

I'm trying to test IPv6 on a couple of sites and I seem to have encountered a bug with nginx.

I have 2 backend servers behind a proxy, all servers run nginx 0.8.53.

If I enter the IPv6 address into the browser, the address is trimmed when it reaches the backend server.

Here is an example using PHP:

Direct request to backend server (works):

http://[2a02:40:40:7::3]/test.php
$_SERVER['HTTP_HOST'] = [2a02:40:40:7::3]

Via proxy:

http://[2a02:40:40:7::7]/test.php
$_SERVER['HTTP_HOST'] = [2a02:40:40:7:

It appears the last semi colon and number are trimmed off the IPv6 address, for example if I enter the full IPv6 address I get this:

http://[2a02:40:40:7:0:0:0:7]/test.php
$_SERVER['HTTP_HOST'] = [2a02:40:40:7:0:0:0

I've spent a couple of hours trying different scenarios and added custom logging to log the value of the $host variable and as far as I can tell nginx seems to always incorrectly trim the value of $host for IPv6 addresses.

Here is an example log entry, with an incorrectly logged host name:

[28/Nov/2010:17:50:08 +0000] [2a02:40:40:7: "GET /test.php HTTP/1.1"

The funny thing is that the correct value is always passed to PHP (for direct requests), but the value of $host is always trimmed incorrectly.
As the host name is passed to the backend server via a proxy_set_header directive the incorrect value is always passed to the backend and therefore incorrectly passed to PHP in this instance.

upstream fast_cgi no port error

Hi,

I'm trying out nginx and some of its features. I'm using stable version:
nginx/0.8.53 on ubuntu server.

If I try to configure fast_cgi to use an upstream backend as in the wiki:

upstream backend {
server localhost:1234;
}

fastcgi_pass backend;


I get the the error no "port in upstream".

According to changelog this looks the same error as appeared in version 0.5.0
and fixed in 0.5.1

Is this a regression or have I overlooked something?

Dick

--
Dick Middleton
dick@fouter.net
PGP Key ID: 0x9F9434FD

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

how to change upload_store path?

Hello,

i have a big server with many devices.
My php script is now looking for the disk, wich is empty.

How can i now change automaticly the upload_store path, without changing
the nginx config file and reaload nginx?
Can i do this?

My php script is like rotating the disks where to upload.

I hope you understand my problem,
best regards
Simon

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153833,153833#msg-153833


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Query: HTTP POST DoS

It should handle ok since its event based (not thread based), as long as the number of connections limit is high enough should be no worse than a keep-alive connection.

On Tue, Nov 23, 2010 at 6:54 AM, Naresh V <nareshov@gmail.com> wrote:
Hi,

How does nginx react to an attack of this kind:

http://www.acunetix.com/blog/web-security-zone/articles/http-post-denial-service/



-Naresh V.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx



--
Warez Scene Free Rapidshare Downloads

2010年11月27日星期六

Empty 200 response...

I noticed something in the log like:
xx.xx.xx.xx - - [28/Nov/2010:15:24:31 +0800] "GET
/86/F9/72/126270873-7AAF3F31101040AE9EF930D272F986B3.jpg HTTP/1.1" 200 0
"-" "-"
xx.xx.xx.xx - - [28/Nov/2010:15:28:15 +0800] "GET
/36/2A/66/126270873-AC844C5F4B3B41D0A439445E662A36A5.jpg HTTP/1.1" 200 0
"-" "-"
xx.xx.xx.xx - - [28/Nov/2010:15:51:20 +0800] "GET
/6E/33/2A/144071609-3E1AB5C70F6E4EECA34F51512A336E6C.jpg HTTP/1.1" 200 0
"-" "-"
Some users reported that they got files with 0 length, and I think this
could be the reason. But I'm not sure how this can happen. Can anyone
help? Thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153794,153794#msg-153794


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx 0.8.53 geoip compilation issue

[code]
>strings /usr/local/lib/libGeoIP.so | grep GeoIP_region_name_by_code
GeoIP_region_name_by_code
[/code]

After checking this i found two instances of geoip libraries installed
on the system, so removed the old library and now nginx compiles, Thank
you Igor.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153558,153643#msg-153643


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx 0.8.53 geoip compilation issue

On Fri, Nov 26, 2010 at 03:08:18PM -0500, st1905 wrote:

> After upgrading to the latest C api from maxmind, following is
> happening
>
> [code]
> src/os/unix/ngx_process.c:490: warning: `sys_errlist' is deprecated; use
> `strerror' or `strerror_r' instead
> src/os/unix/ngx_process.c:490: warning: `sys_nerr' is deprecated; use
> `strerror' or `strerror_r' instead

http://nginx.org/en/docs/sys_errlist.html
This issue will be fixed in upcoming 0.9.0.

> objs/src/http/modules/ngx_http_geoip_module.o: In function
> `ngx_http_geoip_region_name_variable':
> src/http/modules/ngx_http_geoip_module.c:275: undefined reference to
> `GeoIP_region_name_by_code'
> [/code]

Strange, I've just upgraded GeoIP to 1.4.6 from 1.4.4 on my FreeBSD host:

>pkg_info | grep GeoIP
GeoIP-1.4.6 Find the country that any IP address or hostname originates

And nginx have been built without issues. Besides, there is
GeoIP_region_name_by_code() function in lib GeoIP library:

>strings /usr/local/lib/libGeoIP.so | grep GeoIP_region_name_by_code
GeoIP_region_name_by_code


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

2010年11月26日星期五

Is it possible make HttpAccessModule available in context "if"

I hope nginx can be handle this such as,

if ($http_user_agent ~ MSIE) {
allow 127.0.0.1;
deny all;
}
if ($http_cookie ~* "id=([^;] +)(?:;|$)" ) {
allow 10.0.0.1;
deny all;
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153628,153628#msg-153628


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

[alert] stalled cache updating

My log is full of messages like these. What do they mean?

2010/11/26 11:33:49 [alert] 28730#0: *693848 stalled cache updating,
error:0 while closing request, client: IP, server: IP
2010/11/26 11:33:49 [alert] 28730#0: *693853 stalled cache updating,
error:0 while closing request, client: IP, server: IP
2010/11/26 11:33:50 [alert] 28730#0: *693861 stalled cache updating,
error:0 while closing request, client: IP, server: IP
2010/11/26 11:33:52 [alert] 28730#0: *693887 stalled cache updating,
error:0 while closing request, client: IP, server: IP
2010/11/26 11:33:53 [alert] 28730#0: *693914 stalled cache updating,
error:0 while closing request, client: IP, server: IP

CentOS-5.5 x86_64

nginx version: nginx/0.8.53
configure arguments: --sbin-path=/usr/local/sbin --with-http_ssl_module

PHP 5.3.3 (fpm-fcgi) (built: Aug 20 2010 17:09:17)

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153568,153568#msg-153568


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx 0.8.53 geoip compilation issue

After upgrading to the latest C api from maxmind, following is
happening

[code]
src/os/unix/ngx_process.c:490: warning: `sys_errlist' is deprecated; use
`strerror' or `strerror_r' instead
src/os/unix/ngx_process.c:490: warning: `sys_nerr' is deprecated; use
`strerror' or `strerror_r' instead
objs/src/http/modules/ngx_http_geoip_module.o: In function
`ngx_http_geoip_region_name_variable':
src/http/modules/ngx_http_geoip_module.c:275: undefined reference to
`GeoIP_region_name_by_code'
[/code]

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153558,153563#msg-153563


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

nginx 0.8.53 geoip compilation issue

Hello,

When i try to compile geoip module with the latest development version
of the nginx following warning/error occurs

[code]
src/http/modules/ngx_http_geoip_module.c:117: error: 'GeoIPRecord'
has no member named 'continent_code'
cc1: warnings being treated as errors
src/http/modules/ngx_http_geoip_module.c: In function
'ngx_http_geoip_region_name_variable':
src/http/modules/ngx_http_geoip_module.c:275: warning: implicit
declaration of function 'GeoIP_region_name_by_code'
src/http/modules/ngx_http_geoip_module.c:275: warning: assignment makes
pointer from integer without a cast
make[1]: *** [objs/src/http/modules/ngx_http_geoip_module.o] Error 1
make[1]: Leaving directory `/root/nginx-0.8.53'
make: *** [build] Error 2
[/code]

Any idea how to fix this ?

Thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153558,153558#msg-153558


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: i want to install nginx

yes my friend and this they told me

These directives have been added to your nginx configuration. However
I'm
not following how this is to be configured. I'm noticing apache is
running
on port 80, but I'm not seeing what port nginx is intended to be run
on.


i can give you the root to help me to see it and fix it
if it possible

thanks
khaled

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153541,153548#msg-153548


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: i want to install nginx

Have you tried talking to your server provider? I do believe I work for them. I'd be happy to help you with this.

Chris

i want to install nginx

please help me how?
i have root

is ther in this forum support i can pay to him via paypal

thanks

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153541,153541#msg-153541


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx: worker process exited with fatal code 2 and cannot be respawn | eventfd() failed.

Maxim Dounin wrote in post #964105:
> Hello!
>
> On Fri, Nov 26, 2010 at 02:59:11PM +0100, Eric Agbeli wrote:
>
>> >> not have control over. So updating to the latest CentOS is not an option
>> > ./configure && make && make install
>> >
>> > Maxim Dounin
>>
>>
>> Hi in trying to recompile with the command -$./configure
>> --without-file-aio. I am faced with this error.
>>
>> ./configure: error: invalid option "--without-file-aio"
>
> There are no configure argument --without-file-aio, and this error
> is expected.
>
>> I alternatively compiled with the latest nginx source file(nginx-0.8.53)
>> without "--with-file-aio" configure option and it compiled ok. But after
>> reinstalling nginx on the system and running nginx i have the same error
>> existing in the error logs.
>
> Most likely you are starting wrong binary, not the one you've just
> compiled and installed.
>
> Please follow startup scripts you use to find binary you actually
> starting and examine it (with ls -l to check date/time, via
> running with -V switch to see configure arguments).
>
> Maxim Dounin

Thanks a mil for drawing my attention to the fact that i was running the
old binary. I investigated further and realized that the startup script
as you stated was pointing to an old binary. So I modified the script to
point to the new binary and all seems to be working perfectly well. :D
:D

I must add that it seems right to build with the new source which is
nginx-0.8.53. One other thing was that, I faced an error while pointing
to the new binary file. Error is shown below

unknown directive "ssl" in /etc/nginx/nginx.conf

The solution to solving this problem was to recompile nginx with the
configure option "--with-http_ssl_module".

./configure --with-http_ssl_module

THANKS MAXIM!!! 'MEDAASE' as we say in my local dialect.
Cheers!

--
Posted via http://www.ruby-forum.com/.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: SSL handshaking very slow

Arash,

It sounds like your system is running out of entropy. Every time a new
SSL connection is made the system needs to have a certain amount of
"randomness" to make new ssl key negotiations. 20K new connections
seems like a entropy resource starvation. If you are running Linux
check out "rngd" and take a look at our page at the following link.

Entropy and Random Number Generators
https://calomel.org/entropy_random_number_generators.html

--
Calomel @ https://calomel.org
Open Source Research and Reference


On Thu, Nov 25, 2010 at 06:41:08AM -0500, arashf wrote:
>hi there,
>I'm running the latest stable version of nginx and running into a
>strange issue. after a few hour of operation, SSL handshaking stars to
>become very, very slow. in some cases, establishing an SSL connection
>will take over 30 seconds and the browser consequently timeouts. that
>said, when an SSL connection is established, everything is blazing fast.
>similarly, accessing the site over HTTP is fast.
>
>restarting nginx doesn't seem to fix the machine once it gets into this
>state. the only fix is to restart the whole machine. I generally have
>something like 20k SSL sessions active on this machine. changing the SSL
>session timeouts, etc. has no effect once the machine gets into this
>state. are there any obvious parameters (either nginx specific or
>system) that I should be looking at? thanks greatly in advance.
>
>-arash
>
>Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153231,153231#msg-153231
>
>
>_______________________________________________
>nginx mailing list
>nginx@nginx.org
>http://nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx: worker process exited with fatal code 2 and cannot be respawn | eventfd() failed.

Hello!

On Fri, Nov 26, 2010 at 02:59:11PM +0100, Eric Agbeli wrote:

> Maxim Dounin wrote in post #963825:
> > Hello!
> >
> > On Wed, Nov 24, 2010 at 11:53:48PM +0100, Eric A. wrote:
> >
> >> >
> >>
> >> Hi Gena and Maxim,Thank you both for the quick response.
> >> Gena:
> >> I must add that the application is hosted on a remote server which I do
> >> not have control over. So updating to the latest CentOS is not an option
> >> and if you think otherwise please let me know.
> >> Maxim:
> >> I would be glad if you can point me to resources on how I can recompile
> >> nginx *without* --with-file-aio configure since I am not an expect on
> >> compiling nginx, and its looks like its my only option in this case.
> >
> > http://wiki.nginx.org/Install#Building_Nginx_From_Source
> >
> > Basic procedure is as usual:
> >
> > ./configure && make && make install
> >
> > Maxim Dounin
>
>
> Hi in trying to recompile with the command -$./configure
> --without-file-aio. I am faced with this error.
>
> ./configure: error: invalid option "--without-file-aio"

There are no configure argument --without-file-aio, and this error
is expected.

> I alternatively compiled with the latest nginx source file(nginx-0.8.53)
> without "--with-file-aio" configure option and it compiled ok. But after
> reinstalling nginx on the system and running nginx i have the same error
> existing in the error logs.

Most likely you are starting wrong binary, not the one you've just
compiled and installed.

Please follow startup scripts you use to find binary you actually
starting and examine it (with ls -l to check date/time, via
running with -V switch to see configure arguments).

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: nginx: worker process exited with fatal code 2 and cannot be respawn | eventfd() failed.

Maxim Dounin wrote in post #963825:
> Hello!
>
> On Wed, Nov 24, 2010 at 11:53:48PM +0100, Eric A. wrote:
>
>> >
>>
>> Hi Gena and Maxim,Thank you both for the quick response.
>> Gena:
>> I must add that the application is hosted on a remote server which I do
>> not have control over. So updating to the latest CentOS is not an option
>> and if you think otherwise please let me know.
>> Maxim:
>> I would be glad if you can point me to resources on how I can recompile
>> nginx *without* --with-file-aio configure since I am not an expect on
>> compiling nginx, and its looks like its my only option in this case.
>
> http://wiki.nginx.org/Install#Building_Nginx_From_Source
>
> Basic procedure is as usual:
>
> ./configure && make && make install
>
> Maxim Dounin


Hi in trying to recompile with the command -$./configure
--without-file-aio. I am faced with this error.

./configure: error: invalid option "--without-file-aio"

I alternatively compiled with the latest nginx source file(nginx-0.8.53)
without "--with-file-aio" configure option and it compiled ok. But after
reinstalling nginx on the system and running nginx i have the same error
existing in the error logs.

--
Posted via http://www.ruby-forum.com/.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Upstream Accept-Ranges not being respected?

Hi folks,

I'm using 0.8.53, and I've been running into an issue with the Accepts-Range header coupled with X-Accel-Redirect. I'm proxying all non-static requests to an upstream pool which when passed a particular one-time-use URL will set X-Accel-Redirect to an internal location to allow the client to download a protected file. However, despite setting "Accept-Ranges: none" in the upstream server, nginx is appending a second "Append-Ranges: bytes" header before hitting the client. This results in the client aborting the initial download and making several partial followup range requests (which obviously don't succeed as the URL they're hitting can only resolve once). I've tried manually setting Accept-Ranges for the internal location, but that just results in a third Accept-Ranges header being sent to the client in the initial response. I've even tried completely clearing the Accept-Ranges headers with ngx_headers_more, but even that failed.

It seems to me like the correct behavior here would be to respect the upstream server's Accept-Ranges header if it's been set (and preserve it rather than appending to it) as any followup requests will be to the URL that was proxied upstream and thus any range requests must be able to be processed by the upstream servers to succeed.

Thanks,
Zach

Re: gzip issue.

Hello!

On Fri, Nov 26, 2010 at 04:38:56AM -0500, doors wrote:

> Hello!
>
> I use gzip feature with following configuration.
> If upstream server doesn't make a gzip file, everything is ok and
> perfect.
>
> However if upstream server makes a gzip file, NGINX always send a gzip
> file to client.
> in this case, NGINX doesn't check both accep-enconding and user-agent.

If upstream server returned gzip response - nginx won't touch it.
It's expected behaviour.

If you really want nginx to gunzip upstream responses - you may
install gunzip module as available here:

http://mdounin.ru/hg/ngx_http_gunzip_filter_module/
http://mdounin.ru/hg/files/ngx_http_gunzip_filter_module-0.3.tar.gz

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

encode url

Hi,

I'm writing my first nginx module. The module at some point uses the
"Location" header to redirect to user to a landing page. The redirected
url has many arguments which could potentially contain spaces, slashes
or any other non-alphabetic chars.

Is there a function that'll escape then and convert them to %20, %2f and
so on?

Thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153434,153434#msg-153434


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

gzip issue.

Hello!

I use gzip feature with following configuration.
If upstream server doesn't make a gzip file, everything is ok and
perfect.

However if upstream server makes a gzip file, NGINX always send a gzip
file to client.
in this case, NGINX doesn't check both accep-enconding and user-agent.


################
# gzip configuration w/ nginx/0.8.53
################
gzip_static on;
gzip on;
gzip_buffers 64 8k; # 64*8 = 512kbytes
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_types text/plain text/css application/x-javascript text/xml
application/xml application/xml+rss text/javascript
application/javascript;
gzip_min_length 1100;
gzip_disable "msie6";
gzip_vary on;

/YM

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153432,153432#msg-153432


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

2010年11月25日星期四

Re: 答复: Keep-alive and Safari

On Fri, Nov 26, 2010 at 01:54:16PM +0800, Zhang,Tony wrote:

> Hi
>
> Is it also suitable for 0.7.x and 0.6.x ?

It's not suitable for 0.7.x.
0.6.x does not disable keepalive for Safari.

> On Thu, Nov 25, 2010 at 08:23:04PM -0500, doors wrote:
>
> > Is patch for 0.8.53 ?
>
> Yes.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

答复: Keep-alive and Safari

Hi

Is it also suitable for 0.7.x and 0.6.x ?



-----邮件原件-----
发件人: Igor Sysoev [mailto:igor@sysoev.ru]
发送时间: 2010年11月26日 13:53
收件人: nginx@nginx.org
主题: Re: Keep-alive and Safari

On Thu, Nov 25, 2010 at 08:23:04PM -0500, doors wrote:

> Is patch for 0.8.53 ?

Yes.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

This e-mail is confidential. It may also be legally privileged.If you are not the addressee you may not copy, forward, disclose or use any part of it. If you have received this message in error,please delete it and all copies from your system and notify the sender immediately by return e-mail.Internet communications cannot be guaranteed to be timely,secure, error or virus-free. The sender does not accept liability for any errors or omissions.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Keep-alive and Safari

On Thu, Nov 25, 2010 at 08:23:04PM -0500, doors wrote:

> Is patch for 0.8.53 ?

Yes.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Keep-alive and Safari

Is patch for 0.8.53 ?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,151962,153392#msg-153392


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Keep-alive and Safari

It's great.

thanks for prompt response.

/YM

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,151962,153385#msg-153385


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Rewrite - html files without ARGS

On Thu, Nov 25, 2010 at 02:09:50PM -0500, stk wrote:

> Hello,
>
> I wanted to rewrite this url
>
> news/any_file-name-1-9?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+homeinteriors+(Design+Interior)
>
>
> To
>
> news/any_file-name-1-9.html
>
> I wrote
> ************************************
> location = /news {
> if ($args ~ ^ utm_source) {
> set $args "";
> }
> }
> ***********************************
> OR
> **********************************
> location ~* ^.+\.(htm|html)$ {
> if ($args != "") {
> set $args "";
> }
> **********************************
>
>
> But it doesn't work
>
> Can anyone help me? Let me know what I'm doing wrong :/

location /news/ {
location ~ ^/news/(.+)$ {
alias /path/to/files/$1.html;
}
}


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Rewrite - html files without ARGS

Hello,

I wanted to rewrite this url

news/any_file-name-1-9?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+homeinteriors+(Design+Interior)


To

news/any_file-name-1-9.html

I wrote
************************************
location = /news {
if ($args ~ ^ utm_source) {
set $args "";
}
}
***********************************
OR
**********************************
location ~* ^.+\.(htm|html)$ {
if ($args != "") {
set $args "";
}
**********************************


But it doesn't work

Can anyone help me? Let me know what I'm doing wrong :/

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,153328,153328#msg-153328


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx

Re: Keep-alive and Safari

Index: src/http/ngx_http_core_module.c
===================================================================
--- src/http/ngx_http_core_module.c (revision 3111)
+++ src/http/ngx_http_core_module.c (working copy)
@@ -133,6 +133,14 @@
};


+static ngx_conf_enum_t ngx_http_core_keepalive_disable[] = {
+ { ngx_string("none"), NGX_HTTP_KEEPALIVE_DISABLE_NONE },
+ { ngx_string("msie6"), NGX_HTTP_KEEPALIVE_DISABLE_MSIE6 },
+ { ngx_string("safari"), NGX_HTTP_KEEPALIVE_DISABLE_SAFARI },
+ { ngx_null_string, 0 }
+};
+
+
static ngx_path_init_t ngx_http_client_temp_path = {
ngx_string(NGX_HTTP_CLIENT_TEMP_PATH), { 0, 0, 0 }
};
@@ -494,6 +502,13 @@
offsetof(ngx_http_core_loc_conf_t, keepalive_requests),
NULL },

+ { ngx_string("keepalive_disable"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_enum_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_core_loc_conf_t, keepalive_disable),
+ &ngx_http_core_keepalive_disable },
+
{ ngx_string("satisfy"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_enum_slot,
@@ -790,26 +805,6 @@
break;
}

- if (r->keepalive) {
-
- if (r->headers_in.msie6) {
- if (r->method == NGX_HTTP_POST) {
- /*
- * MSIE may wait for some time if an response for
- * a POST request was sent over a keepalive connection
- */
- r->keepalive = 0;
- }
-
- } else if (r->headers_in.safari) {
- /*
- * Safari may send a POST request to a closed keepalive
- * connection and stalls for some time
- */
- r->keepalive = 0;
- }
- }
-
if (r->headers_in.content_length_n > 0) {
r->lingering_close = 1;

@@ -1432,6 +1427,28 @@

} else if (r->connection->requests >= clcf->keepalive_requests) {
r->keepalive = 0;
+
+ } else if (r->headers_in.msie6
+ && r->method == NGX_HTTP_POST
+ && (clcf->keepalive_disable
+ & NGX_HTTP_KEEPALIVE_DISABLE_MSIE6))
+ {
+ /*
+ * MSIE may wait for some time if an response for
+ * a POST request was sent over a keepalive connection
+ */
+ r->keepalive = 0;
+
+ } else if (r->headers_in.safari
+ && (clcf->keepalive_disable
+ & NGX_HTTP_KEEPALIVE_DISABLE_SAFARI))
+ {
+ /*
+ * Safari may send a POST request to a closed keepalive
+ * connection and stalls for some time, see
+ * https://bugs.webkit.org/show_bug.cgi?id=5760
+ */
+ r->keepalive = 0;
}
}

@@ -3061,6 +3078,7 @@
clcf->client_max_body_size = NGX_CONF_UNSET;
clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE;
clcf->client_body_timeout = NGX_CONF_UNSET_MSEC;
+ clcf->keepalive_disable = NGX_CONF_UNSET_UINT;
clcf->satisfy = NGX_CONF_UNSET_UINT;
clcf->if_modified_since = NGX_CONF_UNSET_UINT;
clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT;
@@ -3261,6 +3279,9 @@
ngx_conf_merge_msec_value(conf->client_body_timeout,
prev->client_body_timeout, 60000);

+ ngx_conf_merge_uint_value(conf->keepalive_disable, prev->keepalive_disable,
+ NGX_HTTP_KEEPALIVE_DISABLE_MSIE6
+ |NGX_HTTP_KEEPALIVE_DISABLE_SAFARI);
ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy,
NGX_HTTP_SATISFY_ALL);
ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since,
Index: src/http/ngx_http_core_module.h
===================================================================
--- src/http/ngx_http_core_module.h (revision 3111)
+++ src/http/ngx_http_core_module.h (working copy)
@@ -38,6 +38,11 @@
#define NGX_HTTP_IMS_BEFORE 2


+#define NGX_HTTP_KEEPALIVE_DISABLE_NONE 0x0002
+#define NGX_HTTP_KEEPALIVE_DISABLE_MSIE6 0x0004
+#define NGX_HTTP_KEEPALIVE_DISABLE_SAFARI 0x0008
+
+
typedef struct ngx_http_location_tree_node_s ngx_http_location_tree_node_t;
typedef struct ngx_http_core_loc_conf_s ngx_http_core_loc_conf_t;

@@ -349,6 +354,7 @@
time_t keepalive_header; /* keepalive_timeout */

ngx_uint_t keepalive_requests; /* keepalive_requests */
+ ngx_uint_t keepalive_disable; /* keepalive_disable */
ngx_uint_t satisfy; /* satisfy */
ngx_uint_t if_modified_since; /* if_modified_since */
ngx_uint_t client_body_in_file_only; /* client_body_in_file_only */
On Thu, Nov 25, 2010 at 07:32:05PM +0300, Maxim Dounin wrote:

> Hello!
>
> On Thu, Nov 25, 2010 at 07:09:31PM +0300, Igor Sysoev wrote:
>
> > On Thu, Nov 25, 2010 at 04:49:52PM +0100, Jan Andersson wrote:
> >
> > > Hi,
> > > regading:
> > >
> > > >> I also founded NGIX disabled keep-alive for safari.
> > > >>
> > > >> I am not sure exact reason of this.
> > > >
> > > > http://nginx.org/pipermail/nginx/2010-October/023131.html
> > >
> > > I still beleive it would be great if there was an option to enable keep-alive for Safari.
> > > Not all sites need this work-a-round...
> >
> > The attached patch introduces
> > safari_keepalive on|off;
> > directive. The default value is "off".
> > It will be included in next 0.9.0.
>
> I would like to see something more general, e.g.
>
> keepalive_disable safari msie6;
> keepalive_disable off;
>
> This should be helpfull for servers without POST's at all, and
> looks much more extendable.

You are right. The attached patch introduces
keepalive_disable safari msie6; # default
keepalive_disable none; # turn off


--
Igor Sysoev
http://sysoev.ru/en/