

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
4 messages in ru.sysoev.nginxRe: Map thousands of urls| From | Sent On | Attachments |
|---|---|---|
| Janko Hauser | Jun 14, 2007 3:29 am | |
| Igor Sysoev | Jun 14, 2007 8:31 am | |
| Janko Hauser | Jun 14, 2007 9:17 am | |
| Igor Sysoev | Jun 14, 2007 9:40 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: Map thousands of urls | Actions... |
|---|---|---|
| From: | Igor Sysoev (is-G...@public.gmane.org) | |
| Date: | Jun 14, 2007 9:40:11 am | |
| List: | ru.sysoev.nginx | |
On Thu, Jun 14, 2007 at 06:17:35PM +0200, Janko Hauser wrote:
Am 14.06.2007 um 17:32 schrieb Igor Sysoev:
On Thu, Jun 14, 2007 at 12:29:25PM +0200, Janko Hauser wrote:
Hello, we currently use a homegrown apache module, which maps urls to new domains and urls. For this we use a mysql-lookup. There are O (10000) entries in this table. Now we want to replace Apache with nginx (which is currently used as a load balancing proxy to a big zope cluster f?r 400+ Sites).
What would be the best way to achieve the same effect with nginx? We can live with a solution, where the mysql-table is exported once a night, a new nginx include is written and nginx is reloaded. I think it would be bad to port the apache module to nginx, as a mysql-lookup for each request reduces the benefits of nginx.
The lookup can be exact, so we do not need thousands of rewrites via regex.
Could you show example of mappings ? nginx can do lookups via "map" directive.
Yes I suspected already that "map" could be a solution, but I do not understand what the variables "0;" etc mean.
They are simple strings.
The mapping looks like this,
MAP: /0x0ac80f2b_0x008c8a6e -> http://medien-kunst- industrie.zzz.xxx.de/fachgruppen MAP: /0x0ac80f2b_0x015a8bd2 -> http://handel.yyy.xxx.de/ pressemitteilungen/presse_2004 MAP: /m -> http://mmm.xxx.de/ MAP: /berlin-brandenburg/lbz -> http://bb.xxx.de/
So it should be redirects returned to user ?
map $uri $new {
default http://some.default.de/;
/berlin-brandenburg/lbz http://bb.xxx.de/; /m http://mmm.xxx.de/;
... }
server { server_name www.xxx.de; rewrite ^ $new redirect; }
Currently they only arrive at one host "www.xxx.de" but it would be cool, if also different hosts could be covered, but that's not a stopper.
You may set up several maps or use
set $map $host$uri;
and define "map $map $new { ... }".
-- Igor Sysoev http://sysoev.ru/en/







