Welcome! Log In Create A New Profile

Advanced

Map Module and Domains

Posted by SplitIce 
SplitIce
Map Module and Domains
July 03, 2012 07:10PM
Ok, I was reading up on the map module and it seems the right way to do
this, howeaver I really couldnt think of a way to do this (without just
using the if alternative way).

Blocking domains is what I want to do, my server blocks are per IP
accepting everything for any domain, howeaver I want to filter certain
[blocked] domains away by way of proxy passing or redirecting to another
URL.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Oleksandr V. Typlyns'kyi
Re: Map Module and Domains
July 03, 2012 07:30PM
Tomorrow Jul 4, 2012 at 03:01 SplitIce wrote:

> Ok, I was reading up on the map module and it seems the right way to do
> this, howeaver I really couldnt think of a way to do this (without just
> using the if alternative way).
>
> Blocking domains is what I want to do, my server blocks are per IP
> accepting everything for any domain, howeaver I want to filter certain
> [blocked] domains away by way of proxy passing or redirecting to another
> URL.

You can use another server block for that domains.
http://nginx.org/en/docs/http/request_processing.html

server {
listen 192.168.1.1:80;
...
}

server {
listen 192.168.2.2:80;
...
}

server {
listen 192.168.1.1:80;
listen 192.168.2.2:80;
server_name blocked.example.org *.filtered.net badsite.*;
...
}



--
WNGS-RIPE

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
SplitIce
Re: Map Module and Domains
July 04, 2012 05:50PM
And I take it that the first block is the 'default' so I should add my
'bad-site' block last like you have? Just clarification.

I really like the way you did this, way more clean than the if based system
I was planning to use (and less evil).

On Wed, Jul 4, 2012 at 3:23 AM, Oleksandr V. Typlyns'kyi <[email protected]
> wrote:

> Tomorrow Jul 4, 2012 at 03:01 SplitIce wrote:
>
> > Ok, I was reading up on the map module and it seems the right way to do
> > this, howeaver I really couldnt think of a way to do this (without just
> > using the if alternative way).
> >
> > Blocking domains is what I want to do, my server blocks are per IP
> > accepting everything for any domain, howeaver I want to filter certain
> > [blocked] domains away by way of proxy passing or redirecting to another
> > URL.
>
> You can use another server block for that domains.
> http://nginx.org/en/docs/http/request_processing.html
>
> server {
> listen 192.168.1.1:80;
> ...
> }
>
> server {
> listen 192.168.2.2:80;
> ...
> }
>
> server {
> listen 192.168.1.1:80;
> listen 192.168.2.2:80;
> server_name blocked.example.org *.filtered.net badsite.*;
> ...
> }
>
>
>
> --
> WNGS-RIPE
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Oleksandr V. Typlyns'kyi
Re: Map Module and Domains
July 05, 2012 12:00AM
Today Jul 5, 2012 at 01:45 SplitIce wrote:

> And I take it that the first block is the 'default' so I should add my
> 'bad-site' block last like you have? Just clarification.
>
> I really like the way you did this, way more clean than the if based system
> I was planning to use (and less evil).

It doesn't metter if you add default_server parameter to the right place.
http://nginx.org/en/docs/http/ngx_http_core_module.html#listen

--
WNGS-RIPE

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Ruslan Ermilov
Re: Map Module and Domains
July 05, 2012 05:00PM
On Thu, Jul 05, 2012 at 12:56:43AM +0300, Oleksandr V. Typlyns'kyi wrote:
> Today Jul 5, 2012 at 01:45 SplitIce wrote:
>
> > And I take it that the first block is the 'default' so I should add my
> > 'bad-site' block last like you have? Just clarification.
> >
> > I really like the way you did this, way more clean than the if based system
> > I was planning to use (and less evil).
>
> It doesn't metter if you add default_server parameter to the right place.
> http://nginx.org/en/docs/http/ngx_http_core_module.html#listen

http://nginx.org/en/docs/http/request_processing.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login