Redirecting from mysite.com to www.mysite.com
Jean-Philippe Moal
skateinmars at skateinmars.net
Mon Sep 22 12:09:50 MSD 2008
Thomas a écrit :
> UPDATE: sorry, I had forgotten to add mysite.com to /etc/hosts, so now
> redirection works.
>
> But if I put server_name _; back then I get the loop.
>
> I tried using this trick: http://www.ruby-forum.com/topic/152330
>
> with server_name_in_redirect off;
>
> but I still get the infinite loop.
>
> Do I need to explicitly create a server_name for each domain I am
> handling? I would like to be able to create an unattended config file
> that I won't "ever" touch again.
>
My guess is your server block with "site.com" on the server name is defined
before the other one with the name "_".
The first server block found is the one used when no Host matches any server
name (unless there's a "default" param for a server).
http://wiki.codemongers.com/NginxHttpCoreModule#listen
More information about the nginx
mailing list