Which is better?

Igor Sysoev is at rambler-co.ru
Tue Apr 22 09:05:04 MSD 2008


On Mon, Apr 21, 2008 at 05:50:25PM -0700, mike wrote:

> Is one better than the other?
> 
> combining www. and non-www, and using a conditional:
> 
> server {
>     listen 80;
>     server_name michaelshadle.com www.michaelshadle.com;
>     ... index, root, all that stuff...
> 
>     if ($http_host ~ "^www.(.*)") {
>         set $name $1;
>         rewrite ^/(.*) http://$name/$1 permanent;
>     }
> }
> 
> or making two physical server blocks?
> 
> server {
>     listen 80;
>     server_name michaelshadle.com;
>     ... index, root, all that stuff...
> 
> }
> 
> server {
>     listen 80;
>     server_name www.michaelshadle.com;
>     rewrite ^/(.*) http://michaelshadle.com/$1 permanent;
> }

Second, of course.


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





More information about the nginx mailing list