2011年1月31日星期一

Re: Redirect /olddir to /newdir

On Tue, Feb 01, 2011 at 01:44:13AM -0500, TECK wrote:

> Hi all,
>
> I need your suggestions to create a rewrite rule in nginx that will
> redirect the user from an old dir to the new one:
> http://domain.com/olddir/some/dir/ to
> http://domain.com/newdir/some/dir/
>
> location /newdir/ {
> try_files $uri $uri/ /newdir/index.php?$uri&$args;
> }
> location /olddir/ {
> rewrite ^ http://domain.com/newdir$request_uri? permanent;
> }
>
> The above rule does not work, it will redirect the user to
> http://domain.com/newdir/, instead of
> http://domain.com/newdir/some/dir/.
> If an user types the http://domain.com/olddir/some/dir/ url, nginx
> should automatically redirect him/her to
> http://domain.com/newdir/some/dir/. Right now, it brings the user to
> http://domain.com/newdir/.

location /olddir/ {
rewrite ^/olddir/(.*)$ http://domain.com/newdir/$1 permanent;
}


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

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

Redirect /olddir to /newdir

Hi all,

I need your suggestions to create a rewrite rule in nginx that will
redirect the user from an old dir to the new one:
http://domain.com/olddir/some/dir/ to
http://domain.com/newdir/some/dir/

location /newdir/ {
try_files $uri $uri/ /newdir/index.php?$uri&$args;
}
location /olddir/ {
rewrite ^ http://domain.com/newdir$request_uri? permanent;
}

The above rule does not work, it will redirect the user to
http://domain.com/newdir/, instead of
http://domain.com/newdir/some/dir/.
If an user types the http://domain.com/olddir/some/dir/ url, nginx
should automatically redirect him/her to
http://domain.com/newdir/some/dir/. Right now, it brings the user to
http://domain.com/newdir/.

Thanks for your help.

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


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

Re: Rewriting request to www.domain.com to domain.com

Hello Igor and António,


On 01/31/2011 10:49 PM, Igor Sysoev wrote:
> This configuration should work. Probably, your browser has cached
> old permanent redirects. Or your real configuration is more complex
> than this.

Indeed, it was an error in another part of my configuration.
Thanks for the confirmations!

Zev

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

Re: please convert this .htaccess to NGINX rewrite

On 31 Jan 2011 15h55 WET, nginx-forum@nginx.us wrote:

> its not working,, :( i think its not true antonio..

It should work. But the User Agent string *must* contain '(6a1pre)'.

You can test it yourself with wget.

wget -U 'This is a test of the evil UA (6a1pre) indeed' <your site>

you should get a 403 status code as the result.

--- appa

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

Re: please convert this .htaccess to NGINX rewrite

its not working,, :( i think its not true antonio..

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


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

Re: Rewriting request to www.domain.com to domain.com

On 31 Jan 2011 13h11 WET, appa@perusio.net wrote:

> On 31 Jan 2011 10h53 WET, zblut@cerego.com wrote:
>
> Your rewrite doesn't work because you're not passing along the
> request URI available in the $request_uri variable.
>
> Use 2 server blocks:
>
server {
## This is to avoid the spurious if for sub-domain name
## rewriting. See http://wiki.nginx.org/Pitfalls#Server_Name.
listen 80;

server_name www.foobar.com;
rewrite ^ $scheme://foobar.com permanent;
} # server domain rewrite.

I've read incorrectly what you want to do. You just want to
redirect all www.foobar.com requests to the root foobar.com. Then the
above works.

--- appa


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

Re: Rewriting request to www.domain.com to domain.com

On Mon, Jan 31, 2011 at 07:53:58PM +0900, Zev Blut wrote:

> Hello,
>
>
> I am having a hard time getting the following type of domain rewrite to
> work. This is what I have so far:
>
>
> server {
> listen 80;
>
> charset off;
> server_name www.foobar.com;
>
> access_log /var/log/nginx/iknow_access.log cerelog;
> location / {
> rewrite ^ http://foobar.com permanent;
> }
>
> location /widgets/ {
> return 410;
> }
> location /banners/ {
> return 410;
> }
>
> error_page 404 410 /404.html;
> location = /404.html {
> root /data/foobar/current/public;
> }
> }
>
>
> I want it to rewrite all requests to the www.foobar.com to the flat
> level domain of foobar.com.
>
> I.e. www.foobar.com/awesomelink should be foobar.com
>
> But, I am getting foobar.com/awesomelink instead.
>
> Also, the 410 responses are redirecting just like the location /
> This is with Nginx 0.7.65
>
> Any ideas what I am doing wrong?

This configuration should work. Probably, your browser has cached
old permanent redirects. Or your real configuration is more complex
than this.


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

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

Re: Rewriting request to www.domain.com to domain.com

On 31 Jan 2011 10h53 WET, zblut@cerego.com wrote:

Your rewrite doesn't work because you're not passing along the request
URI available in the $request_uri variable.

Use 2 server blocks:

server {
## This is to avoid the spurious if for sub-domain name
## rewriting. See http://wiki.nginx.org/Pitfalls#Server_Name.
listen 80;

server_name www.foobar.com;
rewrite ^ $scheme://foobar.com$request_uri? permanent;
} # server domain rewrite.


server {
listen 80;

charset off;
server_name www.foobar.com;

access_log /var/log/nginx/iknow_access.log cerelog;

location / {

(...)
}

location /widgets/ {
return 410;
}

location /banners/ {
return 410;
}

error_page 404 410 /404.html;

location = /404.html {
root /data/foobar/current/public;
}
}

> I want it to rewrite all requests to the www.foobar.com to the flat
> level domain of foobar.com.
>
> I.e. www.foobar.com/awesomelink should be foobar.com
>
> But, I am getting foobar.com/awesomelink instead.
>
> Also, the 410 responses are redirecting just like the location /
> This is with Nginx 0.7.65
>
> Any ideas what I am doing wrong?

Cf. above.

--- appa


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

Rewriting request to www.domain.com to domain.com

Hello,


I am having a hard time getting the following type of domain rewrite to
work. This is what I have so far:


server {
listen 80;

charset off;
server_name www.foobar.com;

access_log /var/log/nginx/iknow_access.log cerelog;
location / {
rewrite ^ http://foobar.com permanent;
}

location /widgets/ {
return 410;
}
location /banners/ {
return 410;
}

error_page 404 410 /404.html;
location = /404.html {
root /data/foobar/current/public;
}
}


I want it to rewrite all requests to the www.foobar.com to the flat
level domain of foobar.com.

I.e. www.foobar.com/awesomelink should be foobar.com

But, I am getting foobar.com/awesomelink instead.

Also, the 410 responses are redirecting just like the location /
This is with Nginx 0.7.65

Any ideas what I am doing wrong?

Thanks,
Zev


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

2011年1月30日星期日

Re: Bandwidth usage per file

I have a module to measure the bandwidth of based of the *accounting_id* set in the config file.

http {
http_accounting  on;
....

server / {
    ......

    location /path/to/myfile {
        http_accounting_id  "myfile";

        ....
    }
}
}

the result is write to syslog device, you may filter the result in syslog.



On Sun, Jan 30, 2011 at 7:40 PM, goles <nginx-forum@nginx.us> wrote:
I mean bandwidth used to SERVE file,

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


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



--
Liu Lantao
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/portal .

Re: nginx, spawn-fcgi and php on freebsd - adding '/' incorrectly

Hello!

On Sun, Jan 30, 2011 at 04:05:18PM -0500, khine wrote:

[...]

> > > when you view the site, all links are missing
> > the last '/' so instead of
> > > getting
> > http://dev.editionsdelga.fr/manufacturer.php
> > > you get
> > http://dev.editionsdelga.frmanufacturer.php/
> >
> > You mean - links generated by php scripts on your
> > site, right?
>
> no, because these are actual files on the server and are not generated
> by my application.

I.e. you have problems with links you type yourself in your
browser? Requests are redirected to wrong address?

Anyway, this is likely to be done by your scripts as well, and the
reason is most likely the same: insufficient fastcgi_param's.

Maxim Dounin

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

Re: nginx, spawn-fcgi and php on freebsd - adding '/' incorrectly

hi,

Maxim Dounin Wrote:
-------------------------------------------------------
> Hello!
>
> On Sat, Jan 29, 2011 at 07:46:25PM -0500, khine
> wrote:
>
> > hello, i have nginx setup, but i have a weird
> problem and i am unsure
> > whether it is to do with the application or
> something i messed up on the
> > nginx.conf file:
>
> [...]
>
> > fastcgi_param SCRIPT_FILENAME
> >
> /www/dev.editionsdelga.fr/1.3.6$fastcgi_script_nam
> e;
> > fastcgi_param SERVER_NAME
> $http_host;
> > fastcgi_ignore_client_abort on;
> > fastcgi_param QUERY_STRING
> $query_string;
> > fastcgi_param REQUEST_METHOD
> $request_method;
> > fastcgi_param CONTENT_TYPE
> $content_type;
> > fastcgi_param CONTENT_LENGTH
> $content_length;
> > }
> > } # end server for dev.editionsdelga.fr
> >
> > when you view the site, all links are missing
> the last '/' so instead of
> > getting
> http://dev.editionsdelga.fr/manufacturer.php
> > you get
> http://dev.editionsdelga.frmanufacturer.php/
>
> You mean - links generated by php scripts on your
> site, right?

no, because these are actual files on the server and are not generated
by my application.

[code]
# tree -L 1
.
|-- 404.php
|-- CHANGELOG
...
|-- js
|-- mails
|-- manage
|-- manufacturer.php
|-- modules
|-- my-account.php
|-- new-products.php
|-- order-confirmation.php
...
|-- tools
|-- translations
`-- upload

14 directories, 43 files
[/code]


> Most likely they need params you don't set in your
> config
> (i.e. REQUEST_URI) to construct correct links.
>
> It's really bad idea to set fastcgi_param's by
> hand unless you
> understand what you are doing and have a good
> reason to. Use
> "include fastcgi.conf" instead.

ok, i will move this out.
>
> Maxim Dounin
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx

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


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

Re: Error parsing wp-app.php (Wordpress) on Nginx

That was it, thank you.

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


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

Re: Error parsing wp-app.php (Wordpress) on Nginx

On 30 Jan 2011 16h02 WET, nginx-forum@nginx.us wrote:

> I moved my website from apache to nginx and everything seems to be
> working as expected except (Well, I've only seen that error) when I
> try to create posts through the Atom publishing protocol which can
> be accesed via http://wordpressblog.com/wp-app.php, on apache it
> worked well but on nginx it gives me a 404 error, I think it's not
> only me because every other wordpress blog that is using nginx gives
> me that error. I could only find this that could be semi-related to
> this error: http://core.trac.wordpress.org/ticket/7361 but it is a
> fix for apache and I can't make it work on nginx Any ideas to fix
> it? If you have a wordpress blog running on nginx I'd appreciate if
> you tell me if you can correctly access your wp-app.php file. Note
> that I'm currently using php-cgi with nginx, Could php-fpm make it
> work?
>
> I've also setup a dumb installation for testing purposes at
> http://test.is-gorgeo.us/wp-app.php here is it's php information:
> http://test.is-gorgeo.us/phpinfo.php with this nginx.conf file:
> http://pastebin.com/qeUvpGrk I don't know if it's useful but here is
> the content of the wp-app.php file: http://pastebin.com/dX0Kn18i

This doesn't make sense:
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php last;
}

You're capturing the URI for what?

The Atom publishing works for me. I use a nested location and avoid
fastcgi_split_path_info. Following the suggestions of Igor and Maxim
on the list some time ago. Here's the PHP handling part.

## Regular PHP processing.
location ~ ^(?<script>.+\.php)(?<path_info>.*)$ {
include fastcgi.conf;
## The fastcgi_params must be redefined from the ones
## given in fastcgi.conf. No longer standard names
## but arbitrary: named patterns in regex.
fastcgi_param SCRIPT_FILENAME $document_root$script;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param PATH_INFO $path_info;
## Passing the request upstream to the FastCGI
## listener.
fastcgi_pass unix:/tmp/php-cgi/php-cgi.socket;
## Upload progress support.
track_uploads uploads 60s;
}

Note that this is just a snippet from the full config. There is also a
try_files directive:

## The 'final' attempt to serve the request.
location @nocache {
try_files $uri $uri/ /index.php?q=$uri&$args;
}

This config takes wp-super-cache in consideration. If you just want to
use WP then the config on the Wiki http://wiki.nginx.org/Wordpress,
works (although using fastcgi_split_path_info). In case you're
interested, my WP config is on github: https://github.com/perusio/wordpress-nginx

I've yet to include the multi-site setup.
--- appa


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

Error parsing wp-app.php (Wordpress) on Nginx

I moved my website from apache to nginx and everything seems to be
working as expected except (Well, I've only seen that error) when I try
to create posts through the Atom publishing protocol which can be
accesed via http://wordpressblog.com/wp-app.php, on apache it worked
well but on nginx it gives me a 404 error, I think it's not only me
because every other wordpress blog that is using nginx gives me that
error.
I could only find this that could be semi-related to this error:
http://core.trac.wordpress.org/ticket/7361 but it is a fix for apache
and I can't make it work on nginx
Any ideas to fix it?
If you have a wordpress blog running on nginx I'd appreciate if you tell
me if you can correctly access your wp-app.php file.
Note that I'm currently using php-cgi with nginx, Could php-fpm make it
work?

I've also setup a dumb installation for testing purposes at
http://test.is-gorgeo.us/wp-app.php here is it's php information:
http://test.is-gorgeo.us/phpinfo.php with this nginx.conf file:
http://pastebin.com/qeUvpGrk I don't know if it's useful but here is the
content of the wp-app.php file: http://pastebin.com/dX0Kn18i

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


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

Re: Bandwidth usage per file

I mean bandwidth used to SERVE file,

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


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

Bandwidth usage per file

I need to know the exact bandwidth used to server each file,
Does Nginx support this feature?

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


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

Choose upstream based in a cookie

Hello,

I was reading this setup: http://forum.nginx.org/read.php?11,1259 and it
does what I want, but is this the way to go or there is a better way?
Ame say we should avoid if else?

Thanks

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


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

2011年1月29日星期六

Redis output without $COUNT

Hello,

i play around with the redis2 addon, works perfekt :) But if i
query a value i get one line with "$" and Count of the result.

Is there a option to get only the value without the first line?

Thanks for your help.

Kind regrads

Elena
--
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl


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

[ANNOUNCE] uWSGI 0.9.6.7

Hi all, another maintainance release of the uWSGI server is available.

All the async-users are encouraged to upgrade as the performance of the
new async stack are stellar.

* 0.9.6.7 [20110130]

- a huge amount of async optimizations and fixes
- --logdate takes an optional strftime-like value
- follow $PATH on reloading
- uwsgi.core is exported in WSGI env
- uwsgi.log() respect for --logdate
- initial banner respect for --logdate
- fixed --post-buffering
- default listen backlog queue is now 100
- Python 3 support is no more marked as experimental
- Python 3.2 support
- new option --chroot-reload will force a reload of the uWSGI stack after
a chroot
- fixed a typo in INI parsing

You can download it (or pip install it) from

http://projects.unbit.it/downloads/uwsgi-0.9.6.7.tar.gz

Special thanks for this release go to

&#321;ukasz Wróblewski (logging stuff)
Test157 (async stuff)
Guido Notari (virtual hosting fixes since 0.9.6.6)

--
Roberto De Ioris
http://unbit.it

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

Re: nginx, spawn-fcgi and php on freebsd - adding '/' incorrectly

Hello!

On Sat, Jan 29, 2011 at 07:46:25PM -0500, khine wrote:

> hello, i have nginx setup, but i have a weird problem and i am unsure
> whether it is to do with the application or something i messed up on the
> nginx.conf file:

[...]

> fastcgi_param SCRIPT_FILENAME
> /www/dev.editionsdelga.fr/1.3.6$fastcgi_script_name;
> fastcgi_param SERVER_NAME $http_host;
> fastcgi_ignore_client_abort on;
> fastcgi_param QUERY_STRING $query_string;
> fastcgi_param REQUEST_METHOD $request_method;
> fastcgi_param CONTENT_TYPE $content_type;
> fastcgi_param CONTENT_LENGTH $content_length;
> }
> } # end server for dev.editionsdelga.fr
>
> when you view the site, all links are missing the last '/' so instead of
> getting http://dev.editionsdelga.fr/manufacturer.php
> you get http://dev.editionsdelga.frmanufacturer.php/

You mean - links generated by php scripts on your site, right?
Most likely they need params you don't set in your config
(i.e. REQUEST_URI) to construct correct links.

It's really bad idea to set fastcgi_param's by hand unless you
understand what you are doing and have a good reason to. Use
"include fastcgi.conf" instead.

Maxim Dounin

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

nginx, spawn-fcgi and php on freebsd - adding '/' incorrectly

hello, i have nginx setup, but i have a weird problem and i am unsure
whether it is to do with the application or something i messed up on the
nginx.conf file:

[code]
server {
listen 87.98.133.231:80;
server_name dev.editionsdelga.fr;

location / {
root /www/dev.editionsdelga.fr/1.3.6;
index index.html index.htm index.php;
#see
http://www.prestashop.com/forums/viewthread/61175/installing_prestashop/nginxphpfmp_configuration
rewrite
^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$
/img/p/$1-$2$3.jpg last;
rewrite ^/([0-9]+)\-([0-9]+)/([_a-zA-Z0-9-]*)\.jpg$
/img/p/$1-$2.jpg last;
rewrite
^/([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg
last;
rewrite
"^/lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$
/product.php?id_product=$3&isolang;=$1$5" last;
rewrite
"^/lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$
/product.php?id_product=$2&isolang;=$1$4" last;
rewrite
"^/lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$
/category.php?id_category=$2&isolang;=$1" last;
rewrite
^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$
/product.php?id_product=$2$4 last;
rewrite ^/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$
/product.php?id_product=$1$3 last;
rewrite ^/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$
/category.php?id_category=$1 last;
rewrite ^/content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$
/cms.php?id_cms=$1 last;
rewrite ^/([0-9]+)__([a-zA-Z0-9-]*)(.*)$
/supplier.php?id_supplier=$1$3 last;
rewrite ^/([0-9]+)_([a-zA-Z0-9-]*)(.*)$
/manufacturer.php?id_manufacturer=$1$3 last;
rewrite "^/lang-([a-z]{2})/(.*)$ /$2?isolang=$1" last;


}
# pass the PHP scripts to FastCGI server listening on
127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;

fastcgi_param SCRIPT_FILENAME
/www/dev.editionsdelga.fr/1.3.6$fastcgi_script_name;
fastcgi_param SERVER_NAME $http_host;
fastcgi_ignore_client_abort on;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}
} # end server for dev.editionsdelga.fr

[/code]

when you view the site, all links are missing the last '/' so instead of
getting http://dev.editionsdelga.fr/manufacturer.php
you get http://dev.editionsdelga.frmanufacturer.php/

# nginx -v
nginx version: nginx/0.8.54

# php -v
PHP 5.3.5 with Suhosin-Patch (cli) (built: Jan 26 2011 19:38:46)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with XCache v1.3.1, Copyright (c) 2005-2010, by mOo

Any advice much appreciated.

Norman

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


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

Re: Setting cache parameters via if directives

Hello Jeff...

On Fri, Jan 28, 2011 at 3:08 AM, Jeff Mitchell <jeff@jefferai.org> wrote:
Hello,

We have a particular application (gitweb) that performs a particular,
extraordinarily slow function when the home page is loaded. As the
number of repositories has increased, this has grown to take several
*minutes* per page view (yes, ugh).

To combat this, we tried setting up cache so that this only occurs once
an hour, but it's still causing too much of a problem...both because it
doesn't always last an hour (sometimes we see the delay happen again
sooner) and because when it does expire, it simply takes too long (and
if multiple clients connect at that same time making that request, it
gets even worse).

I think you look the wrong way at the problem you have. You should fix these issues you mention which are NOT the expected behavior before trying to fix your situation with your proposed patch of allowing a different time to a special IP and leave a bot requesting the page.

First problem: early renewal of page.

This is not a mistery why it happens: Either your server it's returning a header that tells nginx to refresh the cache, or you have a problem inside your configuration. If you tell nginx to update each 60 min, it will always respect that except backend server tells nginx to refresh the cache.

Second problem: multiple clientes renewing cache.

This can easily be fixed by using proxy_cache_stale, you can set it up to return users the last cached page while the backend ends updating the first request that expired. This means that after a requests pass to the backend, while that request does not complete, nginx will return the last cached (which already expired) version to any new request for that page.

If you fix those both problems then I think you won't need all that workaround you want to do.

I'm not nginx guru and maybe it's me looking the wrong way at your problem but in case it help this is how I dealt before with the same problem you described.

Good Luck!

Guzmán Brasó
--
http://www.guruhub.com.uy
+59898674020
Montevideo, Uruguay


Re: Vhost support

On Sat, Jan 29, 2011 at 10:37:02PM +1000, Mark Constable wrote:

> On 29/01/11, António P. P. Almeida wrote:
> > Make it:
> > server_name ~^(?<p1>[^\.]*)[\.]*(?<p2>[^\.]*)[\.]*(?<p3>[^\.]*)[\.]*(?<p4>[^\.]+)\.(?<p5>[^\.]+)$;
> > Forgot to escape the "." in the named capturing groups.
>
> Thanks Antonio, this does indeed work. The only downside I can see is
> that the system file path is something like /var/www////com/domain/,
> when there are less than 5 parts, but it still seems to work okay.
>
> server {
> listen 80;
> server_name ~^(?<p1>[^\.]*)[\.]*(?<p2>[^\.]*)[\.]*(?<p3>[^\.]*)[\.]*(?<p4>[^\.]*)[\.]*(?<p5>[^\.]*)$;
>
> location / {
> root /var/www/$p5/$p4/$p3/$p2/$p1;
> index index.html index.htm index.jsx index.php;
> }
> }

You just need to set several servers with different regexes.


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

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

Re: Setting cache parameters via if directives

On 01/29/2011 03:19 AM, Jeff Mitchell wrote:
> On 01/28/2011 10:55 AM, Ryan Malayter wrote:
>> I do something similar using the conditinal setting of variables
>> inside the if block to set Cache-Control values, perhaps you can use a
>> similar method to set the values of proxy_cache_valid. Since setting
>> variables is one of the few "safe" things to do inside an if block,
>> and most directives can take variables as agurments, it is generally
>> useful.
>>
>> location / {
>> set $mycc = "private, max-age=0";
>>
>> if ($foo = "bar") {
>> set $mycc = "public, max-age=3600"
>> }
>>
>> proxy_pass http://backend;
>> add_header Cache-Control $mycc;
>> }
>
> Great idea, thank you.

Unfortunately, this doesn't work:

set $cachevalidval "60m";
if ($remote_addr = "1.2.3.4") {
set $cachevalidval "1m";
}
proxy_pass http://127.0.0.1:80;
proxy_cache gitweb;
proxy_cache_valid any $cachevalidval;

I get complaints that $cachevalidval is an invalid time value. I've
tried doing things like having $cachevalidval only have a number and
then using "$cachevalidval"m but nothing works so far...

Thanks,
Jeff

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

Re: Vhost support

On 29/01/11, António P. P. Almeida wrote:
> Make it:
> server_name ~^(?<p1>[^\.]*)[\.]*(?<p2>[^\.]*)[\.]*(?<p3>[^\.]*)[\.]*(?<p4>[^\.]+)\.(?<p5>[^\.]+)$;
> Forgot to escape the "." in the named capturing groups.

Thanks Antonio, this does indeed work. The only downside I can see is
that the system file path is something like /var/www////com/domain/,
when there are less than 5 parts, but it still seems to work okay.

server {
listen 80;
server_name ~^(?<p1>[^\.]*)[\.]*(?<p2>[^\.]*)[\.]*(?<p3>[^\.]*)[\.]*(?<p4>[^\.]*)[\.]*(?<p5>[^\.]*)$;

location / {
root /var/www/$p5/$p4/$p3/$p2/$p1;
index index.html index.htm index.jsx index.php;
}
}

I'd still be interested to do this without requiring a regex as all
it would take is something like this small amount of code in a module,
or as a patch to core...

char *add_path_element(char *dest, char *element)
{
*dest++ = '/';
strcpy(dest,element);
return dest + strlen(element);
}

[...]
server_name = ap_get_server_name(r);
buf = apr_pstrdup(r->pool, server_name);
rvp = apr_palloc(r->pool, strlen(buf)+1);

r->canonical_filename = "";

/* Work out the reverse path */
for (p = rvp, q = buf+strlen(buf); q >= buf; q--) {
if (*q == '.') {
*q = '\0';
p = add_path_element(p, q+1);
}
}
p = add_path_element(p,buf);
[...]

Anyone care to suggest where is the best place to start to look for
a module or patch to add something like the above?

--markc

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

Re: Vhost support

On 29 Jan 2011 07h58 WET, appa@perusio.net wrote:

> On 29 Jan 2011 07h35 WET, markc@renta.net wrote:
>
>> On 29/01/11, Igor Sysoev wrote:
>>>> This is pretty good but I want to reverse the domain.org $host
>>>> variable and provide, say, a $rhost variable of "org/domain".
>>> [...]
>>>
>>> http://nginx.org/en/docs/http/server_names.html#regex_names
>>
>> Thanks for the reply, but how do I take into account...
>>
>> domain.com
>> www.domain.com
>> www.username.domain.com
>>
>> so, ie; the first one becomes com/domain and the last one becomes
>> com/domain/username/www ?
>>
>> I have tried this but couldn't get it to work...
>>
>> server {
>> server_name ~^(?<p1>\.)?(?<p2>\.)?(?<p3>\.)?(?<p4>\.)?(?<p5>\.);
>> #server_name
>> #~^(?P<p1>\.)?(?P<p2>\.)?(?P<p3>\.)?(?P<p4>\.)?(?P<p5>\.);
>> location / {
>> root /var/www/$p5/$p4/$p3/$p2/$p1;
>> }
>> }
>
> Try with:
>
> server_name
> ~^(?<p1>[^.]*)[\.]*(?<p2>[^.]*)[\.]*(?<p3>[^.]*)[\.]*(?<p4>[^.]+)\.(?<p5>[^.]+);

Make it:

server_name ~^(?<p1>[^\.]*)[\.]*(?<p2>[^\.]*)[\.]*(?<p3>[^\.]*)[\.]*(?<p4>[^\.]+)\.(?<p5>[^\.]+)$;

Forgot to escape the "." in the named capturing groups.

--- appa


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

Re: Setting cache parameters via if directives

On 01/28/2011 10:55 AM, Ryan Malayter wrote:
> I do something similar using the conditinal setting of variables
> inside the if block to set Cache-Control values, perhaps you can use a
> similar method to set the values of proxy_cache_valid. Since setting
> variables is one of the few "safe" things to do inside an if block,
> and most directives can take variables as agurments, it is generally
> useful.
>
> location / {
> set $mycc = "private, max-age=0";
>
> if ($foo = "bar") {
> set $mycc = "public, max-age=3600"
> }
>
> proxy_pass http://backend;
> add_header Cache-Control $mycc;
> }

Great idea, thank you.

--Jeff

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

Re: Vhost support

On Sat, Jan 29, 2011 at 05:35:19PM +1000, Mark Constable wrote:

> On 29/01/11, Igor Sysoev wrote:
> > > This is pretty good but I want to reverse the domain.org $host
> > > variable and provide, say, a $rhost variable of "org/domain".
> > [...]
> >
> > http://nginx.org/en/docs/http/server_names.html#regex_names
>
> Thanks for the reply, but how do I take into account...
>
> domain.com
> www.domain.com
> www.username.domain.com
>
> so, ie; the first one becomes com/domain and the last one becomes
> com/domain/username/www ?
>
> I have tried this but couldn't get it to work...
>
> server {
> server_name ~^(?<p1>\.)?(?<p2>\.)?(?<p3>\.)?(?<p4>\.)?(?<p5>\.);
> #server_name ~^(?P<p1>\.)?(?P<p2>\.)?(?P<p3>\.)?(?P<p4>\.)?(?P<p5>\.);
> location / {
> root /var/www/$p5/$p4/$p3/$p2/$p1;
> }
> }

Make several servers with different regexes:

server {
server_name ~^(?<p1>[^\.]+)\.(?<p2>[^\.]+)\.(?<p3>[^\.]+)\.(?<p4>[^\.]+)$;
location / {
root /var/www/$p4/$p3/$p2/$p1;
}
}

server {
server_name ~^(?<p1>[^\.]+)\.(?<p2>[^\.]+)\.(?<p3>[^\.]+)$;
location / {
root /var/www/$p3/$p2/$p1;
}
}

server {
server_name ~^(?<p1>[^\.]+)\.(?<p2>[^\.]+)$;
location / {
root /var/www/$p2/$p1/www;
}
}


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

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

2011年1月28日星期五

Re: Vhost support

On 29 Jan 2011 07h35 WET, markc@renta.net wrote:

> On 29/01/11, Igor Sysoev wrote:
>>> This is pretty good but I want to reverse the domain.org $host
>>> variable and provide, say, a $rhost variable of "org/domain".
>> [...]
>>
>> http://nginx.org/en/docs/http/server_names.html#regex_names
>
> Thanks for the reply, but how do I take into account...
>
> domain.com
> www.domain.com
> www.username.domain.com
>
> so, ie; the first one becomes com/domain and the last one becomes
> com/domain/username/www ?
>
> I have tried this but couldn't get it to work...
>
> server {
> server_name ~^(?<p1>\.)?(?<p2>\.)?(?<p3>\.)?(?<p4>\.)?(?<p5>\.);
> #server_name
> #~^(?P<p1>\.)?(?P<p2>\.)?(?P<p3>\.)?(?P<p4>\.)?(?P<p5>\.);
> location / {
> root /var/www/$p5/$p4/$p3/$p2/$p1;
> }
> }

Try with:

server_name ~^(?<p1>[^.]*)[\.]*(?<p2>[^.]*)[\.]*(?<p3>[^.]*)[\.]*(?<p4>[^.]+)\.(?<p5>[^.]+);

I'm uncertain about the way the root directive value gets assigned
when there are null valued variables. Never tried anything of that sort.

--- appa


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

Re: Vhost support

On 29/01/11, Igor Sysoev wrote:
> > This is pretty good but I want to reverse the domain.org $host
> > variable and provide, say, a $rhost variable of "org/domain".
> [...]
>
> http://nginx.org/en/docs/http/server_names.html#regex_names

Thanks for the reply, but how do I take into account...

domain.com
www.domain.com
www.username.domain.com

so, ie; the first one becomes com/domain and the last one becomes
com/domain/username/www ?

I have tried this but couldn't get it to work...

server {
server_name ~^(?<p1>\.)?(?<p2>\.)?(?<p3>\.)?(?<p4>\.)?(?<p5>\.);
#server_name ~^(?P<p1>\.)?(?P<p2>\.)?(?P<p3>\.)?(?P<p4>\.)?(?P<p5>\.);
location / {
root /var/www/$p5/$p4/$p3/$p2/$p1;
}
}

--markc

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

Re: Vhost support

On Sat, Jan 29, 2011 at 05:04:23PM +1000, Mark Constable wrote:

> So there doesn't seem to be any interest in some kind of
> vhost_alias module so I'd like to try and write one but I
> need a little help with the nginx codebase.
>
> server {
> listen 80;
> server_name _;
> location / {
> root /var/www/$host;
> }
> }
>
> If I use the above then I get this in the logs...
>
> 2011/01/29 16:09:13 [error] 32404#0:
> *1 "/var/www/domain.org/index.html" is not found
> (2: No such file or directory), client: 192.168.1.2,
> server: _, request: "GET / HTTP/1.1", host: "domain.org"
>
> (yes, I know the /var/www/domain.org directory does not exist)
>
> This is pretty good but I want to reverse the domain.org $host
> variable and provide, say, a $rhost variable of "org/domain".
>
> I have an apache2 module that already does this so I just need
> some orientation or assistance to find where in the nginx code
> to do the same thing so any pointers would be appreciated.
>
> Anyone care to offers some clues?

http://nginx.org/en/docs/http/server_names.html#regex_names


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

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

Vhost support

So there doesn't seem to be any interest in some kind of
vhost_alias module so I'd like to try and write one but I
need a little help with the nginx codebase.

server {
listen 80;
server_name _;
location / {
root /var/www/$host;
}
}

If I use the above then I get this in the logs...

2011/01/29 16:09:13 [error] 32404#0:
*1 "/var/www/domain.org/index.html" is not found
(2: No such file or directory), client: 192.168.1.2,
server: _, request: "GET / HTTP/1.1", host: "domain.org"

(yes, I know the /var/www/domain.org directory does not exist)

This is pretty good but I want to reverse the domain.org $host
variable and provide, say, a $rhost variable of "org/domain".

I have an apache2 module that already does this so I just need
some orientation or assistance to find where in the nginx code
to do the same thing so any pointers would be appreciated.

Anyone care to offers some clues?

--markc

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

Using 'set' values in 'location'?

I'm still working on getting nginx installed but I want to get a head
start on the configuration. I have a couple questions regarding 'set':

1) Can I use variables I create with 'set' in 'location' as regular
strings? Such as:

[code]
server {
set $subdir "/somesubdir";

location $subdir/ {
try_files $uri $uri/ $subdir/index.php;
}
}
[/code]


2) Can I use variables I create with 'set' in 'location' regular
expressions? Such as:

[code]
server {
set $subdir "/somesubdir";

location ~ ^$subdir(.*/)?anotherdir/$ {
rewrite ^ $subdir/index.php last;
}
}
[/code]


I recognize that probably isn't correct syntax for the regular
expression portion since $ indicates 'match end of string', but my goal
here should be clear.

Also open to alternative solutions. I am aware that "if is evil" and
I've read the "pitfalls" wiki documentation, so I was trying to avoid
using 'if' and try to use 'location' and 'rewrite'/'try_files'
exclusively. I also don't have access to a working nginx server yet or
I'd probably just test it myself.

--
Jack

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


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

Re: Setting cache parameters via if directives

On Thu, Jan 27, 2011 at 11:08 PM, Jeff Mitchell <jeff@jefferai.org> wrote:

>    location = / {
>        if ($remote_addr = "1.2.3.4") {
>            proxy_pass http://127.0.0.1:80;
>            proxy_cache gitweb;
>            proxy_cache_valid 200 20m;
>            proxy_read_timeout 300;
>            proxy_send_timeout 300;
>        }
>        proxy_pass http://127.0.0.1:80;
>        proxy_cache gitweb;
>        proxy_cache_valid 200 60m;
>        proxy_cache_use_stale off;
>        proxy_read_timeout 60;
>        proxy_send_timeout 60;
>    }
>
> Any help much appreciated.

I do something similar using the conditinal setting of variables
inside the if block to set Cache-Control values, perhaps you can use a
similar method to set the values of proxy_cache_valid. Since setting
variables is one of the few "safe" things to do inside an if block,
and most directives can take variables as agurments, it is generally
useful.

location / {
set $mycc = "private, max-age=0";

if ($foo = "bar") {
set $mycc = "public, max-age=3600"
}

proxy_pass http://backend;
add_header Cache-Control $mycc;
}


--
RPM

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

2011年1月27日星期四

Re: Remove Cookies from headers

2011/1/27 nfn <nginx-forum@nginx.us>:
> Is there a way to remove cookies sent from the backend?

Use proxy_hide_header Set-Cookie or fastcgi_hide_header Set-Cookie.

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

Setting cache parameters via if directives

Hello,

We have a particular application (gitweb) that performs a particular,
extraordinarily slow function when the home page is loaded. As the
number of repositories has increased, this has grown to take several
*minutes* per page view (yes, ugh).

To combat this, we tried setting up cache so that this only occurs once
an hour, but it's still causing too much of a problem...both because it
doesn't always last an hour (sometimes we see the delay happen again
sooner) and because when it does expire, it simply takes too long (and
if multiple clients connect at that same time making that request, it
gets even worse).

As a result, what I'd like to do is to have the cache expire after an
hour, but once every twenty or thirty minutes manually refresh the
cache. That way clients can use the existing cache while the new page is
being rebuilt, which will then save the new values into the cache and
reset the timer.

So my thought was that I could do something like the code below, but it
doesn't work since I can't put the directives I want into the if block,
and the proxy_pass in the if block (if I remove the cache values) honors
the cache values in the outside location block anyways:

location = / {
if ($remote_addr = "1.2.3.4") {
proxy_pass http://127.0.0.1:80;
proxy_cache gitweb;
proxy_cache_valid 200 20m;
proxy_read_timeout 300;
proxy_send_timeout 300;
}
proxy_pass http://127.0.0.1:80;
proxy_cache gitweb;
proxy_cache_valid 200 60m;
proxy_cache_use_stale off;
proxy_read_timeout 60;
proxy_send_timeout 60;
}

Any help much appreciated.

Thanks,
Jeff

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

Re: Proxy cache doesn't work in regex location?

On 01/27/2011 11:12 PM, Jeff Mitchell wrote:
> Hello,
>
> I have the following two blocks:
>
> location ~* \.atom$ {
> proxy_pass http://thin_projects_cluster;
> proxy_cache projects;
> proxy_cache_valid 200 10m;
> proxy_cache_use_stale off;
> #return 404;
> }
>
> location / {
> proxy_pass http://thin_projects_cluster;
> #proxy_cache projects;
> #proxy_cache_valid 200 10m;
> #proxy_cache_use_stale off;
> }
>
> If I comment out everything in the top block and uncomment the "return
> 404" then I get 404 errors when accessing URLs ending in .atom, so I
> know that that regex is successfully matching some of my content.
>
> That said, the problem I have is that the cache is not working for the
> top block, but if I comment the cache statements in the top block and
> uncomment the cache statements in the bottom block, the cache starts
> populating as expected. I can't figure out what the difference is.
>
> Does anyone know what might be going on?

In what I'm guessing is a similar scenario, I also didn't get caching
working when using try_files to send to a location like @cluster, and
then having those proxy_cache directives at location @cluster.

Does proxy_cache only work for explicitly defined locations?

Thanks,
Jeff

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

Proxy cache doesn't work in regex location?

Hello,

I have the following two blocks:

location ~* \.atom$ {
proxy_pass http://thin_projects_cluster;
proxy_cache projects;
proxy_cache_valid 200 10m;
proxy_cache_use_stale off;
#return 404;
}

location / {
proxy_pass http://thin_projects_cluster;
#proxy_cache projects;
#proxy_cache_valid 200 10m;
#proxy_cache_use_stale off;
}

If I comment out everything in the top block and uncomment the "return
404" then I get 404 errors when accessing URLs ending in .atom, so I
know that that regex is successfully matching some of my content.

That said, the problem I have is that the cache is not working for the
top block, but if I comment the cache statements in the top block and
uncomment the cache statements in the bottom block, the cache starts
populating as expected. I can't figure out what the difference is.

Does anyone know what might be going on?

Thanks,
Jeff

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

Re: keep-alive connection cause download hangs in Nginx after 0.7.67

Am 27.01.2011 um 20:25 schrieb WilliamOMS:

> Hi Maxim,
>
> I can not reproduce this problem without secure download module. I
> will
> send email to author for help.
>


We have a similar problem in a configuration not involving NGINX at
all (it's a complex configuration with Load-Balancers, commercial
firewalls and a "WAF" appliances....)

I would be *highly* interested in explanations of this phenomenon.

So, if you get any leads, would you mind sharing?


Thanks in advance.

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

Re: keep-alive connection cause download hangs in Nginx after 0.7.67

Hi Maxim,

I can not reproduce this problem without secure download module. I will
send email to author for help.

Thanks

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


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

Re: keep-alive connection cause download hangs in Nginx after 0.7.67

Hello!

On Thu, Jan 27, 2011 at 10:48:40AM -0500, WilliamOMS wrote:

> I am running into this download hanging issue. We are using nginx as a
> download server with SSL and secure download module enabled. When using
> nginx-0.7.67, it works well. But when we try to upgrade to nginx-0.8.54,
> there is a download hanging issue. We figured out it is related to
> keep-alive header or reusing TCP connection. When we download a small
> file and it finished, then in a few seconds, in same browser, if trying
> to download again, the download hangs. Nginx doesn't print out any log
> message. If we turn off keep-alive in either browser or nginx server in
> 0.8.54 by setting keepalive_timeout 0;, then it works well.
>
> Our environment is: Solaris 10, nginx 0.7.67/0.8.54, secure download
> module, SSL.
>
> The other difference between 0.7.67 and 0.8.54 is in the error.log
> message. In 0.7.67, when download finished, it always print out message
> as below:
> 2011/01/27 15:27:31 [info] 12616#0: *1 client xxx.xxx.xxx.xxx
> closed keepalive connection
> But in 0.8.54, it never prints out this message. We have same config
> file for both 0.7.67 and 0.8.54.
>
> I think setting keepalive_timeout to 0 is just a workaround and it may
> have performance impact. Trying to find out if there is better solution
> for this.
>
> Thanks for any suggestions.

Are you able to reproduce the problem without 3rd party modules?

If yes - please provide more information (nginx -V output, config,
debug log), see http://wiki.nginx.org/Debugging for details.

Maxim Dounin

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

Re: FastCGI backend issue

> I've posted some patches which change things as
> part of keepalive
> with backends work, but most likely you don't want
> to rely on
> them. You may want to make your app actually

Is there an bug/issue tracker that tracks this?

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


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

Remove Cookies from headers

Hello,

Is there a way to remove cookies sent from the backend?
In varnish we have "unset req.http.cookie" (when receiving the request
before sending to the backend) or "unset beresp.http.set-cookie" (when
sending the response from the backend to the client) to manipulate
cookies.

I'm not using cache .. just want to remove cookies before the response
is sent to the client.

Do we have any similar option to do this?

Thanks

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


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

keep-alive connection cause download hangs in Nginx after 0.7.67

Hello,

I am running into this download hanging issue. We are using nginx as a
download server with SSL and secure download module enabled. When using
nginx-0.7.67, it works well. But when we try to upgrade to nginx-0.8.54,
there is a download hanging issue. We figured out it is related to
keep-alive header or reusing TCP connection. When we download a small
file and it finished, then in a few seconds, in same browser, if trying
to download again, the download hangs. Nginx doesn't print out any log
message. If we turn off keep-alive in either browser or nginx server in
0.8.54 by setting keepalive_timeout 0;, then it works well.

Our environment is: Solaris 10, nginx 0.7.67/0.8.54, secure download
module, SSL.

The other difference between 0.7.67 and 0.8.54 is in the error.log
message. In 0.7.67, when download finished, it always print out message
as below:
2011/01/27 15:27:31 [info] 12616#0: *1 client xxx.xxx.xxx.xxx
closed keepalive connection
But in 0.8.54, it never prints out this message. We have same config
file for both 0.7.67 and 0.8.54.

I think setting keepalive_timeout to 0 is just a workaround and it may
have performance impact. Trying to find out if there is better solution
for this.

Thanks for any suggestions.

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


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

Re: Theme Background Wordpress Error / Blank

Hi Banu,

Could you please post your nginx site settings? It's looks like you have some wrong locations rules or some url settings misconfigured at WP. From what i could dig, your theme styles are both returning a 404


Could you please confirm the correct url for your blog and theme files? and also could you post the result of "SELECT option_name, option_value FROM {table prefix}_options WHERE option_name = 'home' OR option_name = 'siteurl'"

Regards

M

On Thu, Jan 27, 2011 at 11:30 AM, banu utomo <bhanu.utomo@gmail.com> wrote:
I am sorry to bother you. But I have absolutely no idea what was happening on my blog http://profilartis.net. There, the theme is not going well.

Why can not I change the theme of these blogs?
When changing themes always appear blank and just plain white background, I've tried to replace the other wordpress themes but still like it except when using the default wordpress theme.

I've also been looking for answers on google but I'm confused, I tried to ask the hosting support but they suggested to ask here http://nginx.org/en/support.html

I hope you can help me ..

Thank you!

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




--
Nunca hubo un amigo que hiciese un favor a un enano, ni un enemigo que le hiciese un mal, que no se viese recompensado por entero.

Re: rewrite scheme for url redirect

On 27 Jan 2011 14h17 WET, nginx-forum@nginx.us wrote:


> Because the regexp you posted has curly braces. So, following nginx
> wiki (http://wiki.nginx.org/HttpRewriteModule#rewrite) i tried to
> wrap it into both single and double quotes but with no result:

I overlooked that :(

> location /oldfolder { rewrite
> '^/oldfolder/(\d{2})(\d{2})(\d{2})_(\d)\.jpg$'
> http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg?
> permanent; }
>
> location /oldfolder { rewrite
> "^/oldfolder/(\d{2})(\d{2})(\d{2})_(\d)\.jpg$"
> http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg?
> permanent; }
>
> Nginx doesn't redirect my uri requests, so the problem still
> remains...

I suggest you check the logs and/pr enable the debug flag and trace
Nginx request processing. It will tell what's really going on. The
above regex does capture the patterns you want, so something else must
be creating the problems.

--- appa


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

Re: rewrite scheme for url redirect

António P. P. Almeida Wrote:
-------------------------------------------------------
> On 26 Jan 2011 21h11 WET, nginx-forum@nginx.us
> wrote:
>
> > I'm going crazy with this since I can't get it
> working in any way...
> >
> > I have a subdomain on a server, let's call it
> images.site1.com,
> > dedicated to serve images. Due to some bandwidth
> limitation i got a
> > more capable server so the webpages will remain
> on site1.com but the
> > images will be moved to images.site2.com
> >
> > Since I had to change the names of images
> folders on the new server
> > now I need to rewrite the urls in order to fit
> my needs. Only the
> > webserver on site1.com runs NginX, so i need to
> do rewrite the
> > original ruls following a regular expression
> (regex) and do
> > something like:
> >
> >
> http://images.site1.com/oldfolderjpg/123456_1.jpg
> --rewrite-->
> >
> http://images.site2.com/newfolderjpg/12/34/new_ima
> ges/123456/123456_image_1_large.jpg
> >
> > - The first and most logic rewrite scheme I
> tought about is:
> >
> > rewrite
> >
> ^/oldfolder/([0-9][0-9])([0-9][0-9])([0-9][0-9])_(
> [0-9]).jpg$
> >
> http://images.site2.com/newfolder/$1/$2/new_images
> /$1$2$3/$1$2$3_image_$4_large.jpg
> > permanent
>
> On images.site1.com config try this:
>
> location /oldfolder {
> rewrite
> ^/oldfolder/(\d{2})(\d{2})(\d{2})_(\d)\.jpg$
> http://images.site2.com/newfolder/$1/$2/new_images
> /$1$2$3/$1$2$3_image_$4_large.jpg? permanent;
> }

I tried your solution but it has a semantic error cause nginx replies

nginx: [emerg] directive "rewrite" is not terminated by ";"

Because the regexp you posted has curly braces. So, following nginx wiki
(http://wiki.nginx.org/HttpRewriteModule#rewrite) i tried to wrap it
into both single and double quotes but with no result:

location /oldfolder {
rewrite '^/oldfolder/(\d{2})(\d{2})(\d{2})_(\d)\.jpg$'
http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg?
permanent;
}

location /oldfolder {
rewrite "^/oldfolder/(\d{2})(\d{2})(\d{2})_(\d)\.jpg$"
http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg?
permanent;
}

Nginx doesn't redirect my uri requests, so the problem still remains...

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

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


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

Theme Background Wordpress Error / Blank

I am sorry to bother you. But I have absolutely no idea what was happening on my blog http://profilartis.net. There, the theme is not going well.

Why can not I change the theme of these blogs?
When changing themes always appear blank and just plain white background, I've tried to replace the other wordpress themes but still like it except when using the default wordpress theme.

I've also been looking for answers on google but I'm confused, I tried to ask the hosting support but they suggested to ask here http://nginx.org/en/support.html

I hope you can help me ..

Thank you!

Re: header with underscore

On Thu, Jan 27, 2011 at 09:41:39AM +0100, Daniele Melosi wrote:

> Hi all,
>
> when proxy from nginx, if the headers contains underscore it won't be
> passed:
> $ curl -s http://proxy01.ced:8888/check_headers.php --header "Host:
> myhost" --header "X_UP_CALLING_LINE_ID: daniele" | grep daniele
>
> $ curl -s http://proxy01.ced:8888/check_headers.php --header "Host:
> myhost" --header "X-UP-CALLING-LINE-ID: daniele" | grep daniele
> [HTTP_X_UP_CALLING_LINE_ID] => daniele
>
>
> This is my configuration:
> server {
> listen 8888;
> server_name proxy01.ced;
>
> keepalive_timeout 0;
> ssi off;
>
> underscores_in_headers on;
>
> location ~ / {
> proxy_pass http://test01.ced$request_uri;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header Host $host;
> proxy_set_header X-Org-host $host;
> proxy_set_header X-Org-uri $request_uri;
> proxy_set_header X-Forwarded-For
> $proxy_add_x_forwarded_for;
> proxy_pass_header Server;
> proxy_set_header X-UP-CALLING-LINE-ID
> $HTTP_X_UP_CALLING_LINE_ID;
> }
> }
>
> I tried to play with:
> - underscores_in_headers on|off
> - proxy_set_header X-UP-CALLING-LINE-ID $HTTP_X_UP_CALLING_LINE_ID
> - proxy_pass_header X-UP-CALLING-LINE-ID (also with underscore)
>
> lines but without any fortune :)

You should set
underscores_in_headers on;

and remove
proxy_pass_header X-UP-CALLING-LINE-ID
proxy_set_header X-UP-CALLING-LINE-ID ...

nginx should pass "X_UP_CALLING_LINE_ID: daniele" to backend as is.


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

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

Re: rewrite scheme for url redirect

Hi Sevy,

I looked at your rewrite rule, created a similar setup (with nginx 0.8.53)
and...the rewrite rule works as expected. I attach my setup (the conf file and
the whole directory in tar.bz2).
The only thing I can think of at this point is that your NGINX was compiled
without regex support (PCRE).

Feel free to send me your conf file.

Antoine.

----- Original Message ----
From: sevy <nginx-forum@nginx.us>
To: nginx@nginx.org
Sent: Wed, January 26, 2011 10:11:30 PM
Subject: rewrite scheme for url redirect

I'm going crazy with this since I can't get it working in any way...

I have a subdomain on a server, let's call it images.site1.com,
dedicated to serve images. Due to some bandwidth limitation i got a more
capable server so the webpages will remain on site1.com but the images
will be moved to images.site2.com

Since I had to change the names of images folders on the new server now
I need to rewrite the urls in order to fit my needs. Only the webserver
on site1.com runs NginX, so i need to do rewrite the original ruls
following a regular expression (regex) and do something like:

http://images.site1.com/oldfolderjpg/123456_1.jpg
--rewrite-->
http://images.site2.com/newfolderjpg/12/34/new_images/123456/123456_image_1_large.jpg


- The first and most logic rewrite scheme I tought about is:

rewrite ^/oldfolder/([0-9][0-9])([0-9][0-9])([0-9][0-9])_([0-9]).jpg$
http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg

permanent;But it didn't work (I really don't know why)

- The second way I tried out is:

location /oldfolder/([0-9][0-9])([0-9][0-9])([0-9][0-9])_([0-9]).jpg$ {
rewrite ^
http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg

permanent;
}And it didn't work either...

I tried this config too:

location ~ oldfolder/ {
rewrite ^([0-9][0-9])([0-9][0-9])([0-9][0-9])_([0-9]).jpg$
http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg

permanent;
}But with no luck...

After that I tried an old config cheme i used for another site (on the
same box) for a cdn config:

location ~ /oldfolder/([0-9][0-9])([0-9][0-9])([0-9][0-9])_([0-9]).jpg
{
rewrite ^/(.*)$
$scheme://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg;

}I've been triying in several ways but nginx keeps ignoring my rewrite
scheme redirecting to my default error image located at
images.site1.com/error.jpg

Can anyone help me with this?

I'll write down my subdomain server config for your facility:

## images.site1.com ##

server {
listen 80;
server_name images.site1.com;
error_page 404 http://images.site1.com/error.jpg;
root /home/sites/site1.com/images;
}It's a very basic server config, that's why I can't understand
why nginx doesn't rewrite the images following such scheme...

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


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

header with underscore

Hi all,

when proxy from nginx, if the headers contains underscore it won't be
passed:
$ curl -s http://proxy01.ced:8888/check_headers.php --header "Host:
myhost" --header "X_UP_CALLING_LINE_ID: daniele" | grep daniele

$ curl -s http://proxy01.ced:8888/check_headers.php --header "Host:
myhost" --header "X-UP-CALLING-LINE-ID: daniele" | grep daniele
[HTTP_X_UP_CALLING_LINE_ID] => daniele


This is my configuration:
server {
listen 8888;
server_name proxy01.ced;

keepalive_timeout 0;
ssi off;

underscores_in_headers on;

location ~ / {
proxy_pass http://test01.ced$request_uri;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Org-host $host;
proxy_set_header X-Org-uri $request_uri;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_pass_header Server;
proxy_set_header X-UP-CALLING-LINE-ID
$HTTP_X_UP_CALLING_LINE_ID;
}
}

I tried to play with:
- underscores_in_headers on|off
- proxy_set_header X-UP-CALLING-LINE-ID $HTTP_X_UP_CALLING_LINE_ID
- proxy_pass_header X-UP-CALLING-LINE-ID (also with underscore)

lines but without any fortune :)

Do you have any hits ?

Regards

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

2011年1月26日星期三

Re: nginx 0day exploit for nginx + fastcgi PHP

On Wed, Jan 26, 2011 at 9:23 PM, Edho P Arief <edhoprima@gmail.com> wrote:

> I believe one of the solution is adding
>
> try_files $uri =403;

It adds another stat call or two but I believe it's acceptable (and
the stat calls are cached using open_file_cache

> And the other is to not use php at all :)

Blasphemy!

You can also use something Igor had mentioned using named captures:

location ~ ^(?<script>.+\.php)(?<path_info>.*)$ {
... other fastcgi params ...
fastcgi_param SCRIPT_FILENAME $document_root$script;
}

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

Re: nginx 0day exploit for nginx + fastcgi PHP

On Thu, Jan 27, 2011 at 11:07 AM, gdork <nginx-forum@nginx.us> wrote:
> 40 of my servers were compromised because of this issue and I just found
> out about it...aarrrghhhh.
> There are php cmd shell trojans everywhere now!
>
> I was able to easily replicate this issue, and the cgi.fix_pathinfo=0
> fix did NOT work on my systems.
>
> Adding:
>
> location ~ \..*/.*\.php$ {
> return 403;
> }
>

I believe one of the solution is adding

try_files $uri =403;

to the php block.

Other one is to allow php on specific directory/file only.
Other one is to disable php on user-upload directory by creating its
own location block.

And the other is to not use php at all :)

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

What is the optimized configuration for FLV stream

Hi,

I'm configing a http(pseudo)-stream server for flv media files. As a
newcomer to Nginx, I'm wondering what is the special configuration
should I care about on performance/throughput etc. The following is my
current config which is straightforward:
[code]
# My Stream media(flv) server

server {

listen 80;

server_name vd.my.domain;

default_type application/octet-stream;

sendfile on;

root /path/to/flv/files/

location ~* \.flv$ {
flv;
}
}
[/code]

I fount some points in this post
"[url=http://forum.nginx.org/read.php?2,77934,77934]nginx slow at
streaming flv[/url]", but it's seemed a bit old and some directives not
available in the latest nginx version . Any suggestion ?

Especially, according to the post mentioned above, should I turn off the
[b]sendfile[/b] ? shoud it be better to using [b]directio[/b] and
[b]read_ahead[/b] ? or should I put another Nginx instance in front of
this one to proxy it to use the proxy cache ability of nginx? I know
the best way is to test by myself, but a right direction guide will help
me a lot.

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


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

Re: nginx 0day exploit for nginx + fastcgi PHP

it's not a vulnerability with nginx, it's a widespread configuration
misstep teamed up with what I consider to be somewhat lazy application
code (it should check filetype and/or convert and normalize it to site
specifications and/or strip extra stuff inside of it ...)

there's a couple different ways to address it with nginx
configuration, and there is a way to address it in application code
too.

doesn't this fix basically say "if there is a period in the path
before the path ends with PHP throw a 403" - because then
/my.directory/foo.php would be denied, right?

location ~ \..*/.*\.php$ {
return 403;
}


On Wed, Jan 26, 2011 at 8:07 PM, gdork <nginx-forum@nginx.us> wrote:
> 40 of my servers were compromised because of this issue and I just found
> out about it...aarrrghhhh.
> There are php cmd shell trojans everywhere now!
>
> I was able to easily replicate this issue, and the cgi.fix_pathinfo=0
> fix did NOT work on my systems.
>
> Adding:
>
> location ~ \..*/.*\.php$ {
> return 403;
> }
>
>
> Did solve the issue however.
>
> It is VERY common for image hosting sites to allow file uploads to the
> web directory.
> Any can upload a php file as an image and immediately execute it.
> nginx should NOT allow the fastcgi backend to execute code in a file
> that does not even exist.
>
> /blah/blah/virusimage.jpg/hello.php should never execute the hidden php
> code inside the file virusimage.jpg
> I wonder how many sites have been trojaned because of this.  Ive been
> searching vulnerability databases for days and never came across this
> nginx issue. :(
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,88845,169953#msg-169953
>
>
> _______________________________________________
> 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 0day exploit for nginx + fastcgi PHP

40 of my servers were compromised because of this issue and I just found
out about it...aarrrghhhh.
There are php cmd shell trojans everywhere now!

I was able to easily replicate this issue, and the cgi.fix_pathinfo=0
fix did NOT work on my systems.

Adding:

location ~ \..*/.*\.php$ {
return 403;
}


Did solve the issue however.

It is VERY common for image hosting sites to allow file uploads to the
web directory.
Any can upload a php file as an image and immediately execute it.
nginx should NOT allow the fastcgi backend to execute code in a file
that does not even exist.

/blah/blah/virusimage.jpg/hello.php should never execute the hidden php
code inside the file virusimage.jpg
I wonder how many sites have been trojaned because of this. Ive been
searching vulnerability databases for days and never came across this
nginx issue. :(

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


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

Re: rewrite scheme for url redirect

On 26 Jan 2011 21h11 WET, nginx-forum@nginx.us wrote:

> I'm going crazy with this since I can't get it working in any way...
>
> I have a subdomain on a server, let's call it images.site1.com,
> dedicated to serve images. Due to some bandwidth limitation i got a
> more capable server so the webpages will remain on site1.com but the
> images will be moved to images.site2.com
>
> Since I had to change the names of images folders on the new server
> now I need to rewrite the urls in order to fit my needs. Only the
> webserver on site1.com runs NginX, so i need to do rewrite the
> original ruls following a regular expression (regex) and do
> something like:
>
> http://images.site1.com/oldfolderjpg/123456_1.jpg --rewrite-->
> http://images.site2.com/newfolderjpg/12/34/new_images/123456/123456_image_1_large.jpg
>
> - The first and most logic rewrite scheme I tought about is:
>
> rewrite
> ^/oldfolder/([0-9][0-9])([0-9][0-9])([0-9][0-9])_([0-9]).jpg$
> http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg
> permanent

On images.site1.com config try this:

location /oldfolder {
rewrite ^/oldfolder/(\d{2})(\d{2})(\d{2})_(\d)\.jpg$
http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg? permanent;
}

--- appa


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

Re: rewrite scheme for url redirect

That was my typeing error cause I was writing this post on a text file
before posting it.
I just meant /oldfolder/ so forget the jpg at the end of the folder
name.

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


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

Re: rewrite scheme for url redirect

Hi Sevy,

Not an nginx expert, but you say :

"http://images.site1.com/oldfolderjpg/123456_1.jpg"
and
"rewrite ^/oldfolder/([0-9][0-9])([0-9][0-9])([0-9][0-9])_([0-9]).jpg$"

Shouldn't the rewrite be :
rewrite ^/oldfolderjpg/([0-9][0-9])([0-9][0-9])([0-9][0-9])_([0-9]).jpg$

Notice the oldfolderjpg instead of oldfolder. That would explain a lot...

Antoine.

----- Original Message ----
From: sevy <nginx-forum@nginx.us>
To: nginx@nginx.org
Sent: Wed, January 26, 2011 10:11:30 PM
Subject: rewrite scheme for url redirect

I'm going crazy with this since I can't get it working in any way...

I have a subdomain on a server, let's call it images.site1.com,
dedicated to serve images. Due to some bandwidth limitation i got a more
capable server so the webpages will remain on site1.com but the images
will be moved to images.site2.com

Since I had to change the names of images folders on the new server now
I need to rewrite the urls in order to fit my needs. Only the webserver
on site1.com runs NginX, so i need to do rewrite the original ruls
following a regular expression (regex) and do something like:

http://images.site1.com/oldfolderjpg/123456_1.jpg
--rewrite-->
http://images.site2.com/newfolderjpg/12/34/new_images/123456/123456_image_1_large.jpg


- The first and most logic rewrite scheme I tought about is:

rewrite ^/oldfolder/([0-9][0-9])([0-9][0-9])([0-9][0-9])_([0-9]).jpg$
http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg

permanent;But it didn't work (I really don't know why)

- The second way I tried out is:

location /oldfolder/([0-9][0-9])([0-9][0-9])([0-9][0-9])_([0-9]).jpg$ {
rewrite ^
http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg

permanent;
}And it didn't work either...

I tried this config too:

location ~ oldfolder/ {
rewrite ^([0-9][0-9])([0-9][0-9])([0-9][0-9])_([0-9]).jpg$
http://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg

permanent;
}But with no luck...

After that I tried an old config cheme i used for another site (on the
same box) for a cdn config:

location ~ /oldfolder/([0-9][0-9])([0-9][0-9])([0-9][0-9])_([0-9]).jpg
{
rewrite ^/(.*)$
$scheme://images.site2.com/newfolder/$1/$2/new_images/$1$2$3/$1$2$3_image_$4_large.jpg;

}I've been triying in several ways but nginx keeps ignoring my rewrite
scheme redirecting to my default error image located at
images.site1.com/error.jpg

Can anyone help me with this?

I'll write down my subdomain server config for your facility:

## images.site1.com ##

server {
listen 80;
server_name images.site1.com;
error_page 404 http://images.site1.com/error.jpg;
root /home/sites/site1.com/images;
}It's a very basic server config, that's why I can't understand
why nginx doesn't rewrite the images following such scheme...

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


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

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