Conflicting server name - i don't understand
Igor Sysoev
is at rambler-co.ru
Thu Sep 3 16:19:43 MSD 2009
On Wed, Sep 02, 2009 at 06:06:34PM -0400, Jim Ohlstein wrote:
> Nuno Magalh??es wrote:
> >>This does not generate any errors.
> >>
> >Glad to hear it.
> >
> >
> >
> >>(Yes, I also don't like the www prefix.)
> >>
> >Do you have a specific reason for using two server{ } for the same
> >domain? Other than
> >
> >
> >>This also is *exactly* how Igor suggested that I do it.
> >>
> >
> >
>
> Yes. *If* I recall correctly, it came about when I posted a site
> configuration for another reason. At the time I was using an "if" clause
> to rewrite "www.domain.com" to "domain.com".
>
> It probably went something like:
>
> <http://wiki.nginx.org/NginxHttpRewriteModule#if>if ($host ~* www\.(.*)) {
> <http://wiki.nginx.org/NginxHttpRewriteModule#set>set $host_without_www
> $1;
> rewrite <http://wiki.nginx.org/NginxHttpRewriteModule#rewrite> ^(.*)$
> <http://wiki.nginx.org/NginxHttpCoreModule#http>
> http://$host_without_www$1 permanent;
> }
>
>
> Again, *if* I recall correctly, Igor suggested that using a separate
> server entry with a rewrite and eliminating the "if" clause would be far
> more efficient. It's been far too many years than I care to admit (but
> perhaps near if not greater than the median age on this mailing list)
> since I mucked around in C so who am I to argue?
Yes, you are right. This was from the very start.
> >>But even if I didn't do it that way I would still use separate servers for
> >>80 and 443 for the same domain.
> >>
> >
> >Does the listen directive accept multiple values? Or does the server
> >accept multiple listen directives?
>
> I don't know. Never tried.
>
> >The latter seems to be true
> >according to the wiki, so why the separation?
> >
> >
> Cleaner. Easier to edit and follow. Easier to cut and paste when
> creating new domains. Probably more style than substance though. :)
>
> Jim
>
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list