problem with setting Virtual Hosts
    Francis Daly 
    francis at daoine.org
       
    Wed Mar 23 21:07:52 MSK 2011
    
    
  
On Wed, Mar 23, 2011 at 01:16:14PM -0400, chatfeed wrote:
Hi there,
> I wrote as the following site.
> 
> http://wiki.nginx.org/VirtualHostExample
Despite what it shows on that page, it is usually best...
>   server_name star.domain.com *.domain.com; # Alternately: _
> 
>   root /data/www/$host/;
> 
>   error_page 404 errors/404.html;
...if the last argument to error_page starts with "/" or "@".
So make it "/errors/404.html" and you should see something more
useful. (Or just remove the line entirely, for a slightly different
result.)
> when i vist  a.domain.com
> 
> but the website redirect to the following site.
> 
> http://a.domaincom/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/errors/404.html
You ask for http://a.domain.com/; nginx presumably doesn't see the file
/data/www/a.domain.com/index.php and so generates a http 404 error; your
error_page setting says "do an external redirect to errors/404.html",
which is returned to your browser.
It then asks for http://a.domain.com/errors/404.html; nginx doesn't see
the file /data/www/a.domain.com/errors/404.html and generates a http
404 error which becomes an external redirect, so your browser asks for
http://a.domain.com/errors/errors/404.html; and this continues until
your browser decides it has seen too many redirects.
So: delete or change the error_page line to prevent the loop; and add
content to the right directory to avoid the initial 404 error.
Good luck with it,
	f
-- 
Francis Daly        francis at daoine.org
    
    
More information about the nginx
mailing list