nginx server redirect

Edho P Arief edhoprima at gmail.com
Sun Jun 21 09:30:37 MSD 2009


On Sun, Jun 21, 2009 at 12:19 PM, Edho P Arief<edhoprima at gmail.com> wrote:
>
> here it is
>        server {
>                listen 80;
>                server_name ~(.*)\.([^\.]*)\.([^\.]*)$;
>                set $domain $2.$3;
>                rewrite ^.* http://$domain$request_uri permanent;
>        }
>

make sure that you have the server_name set on nginx or it'll redirect to .

this will catch all anydomain.tld
        server {
               listen 80;
               server_name ~[^\.]*\.[^\.]*;
               return 403;
        }



-- 
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org





More information about the nginx mailing list