Welcome! Log In Create A New Profile

Advanced

Re: problem with setting Virtual Hosts

Francis Daly
March 23, 2011 02:10PM
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@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

problem with setting Virtual Hosts

chatfeed March 23, 2011 01:16PM

Re: problem with setting Virtual Hosts

Francis Daly March 23, 2011 02:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 179
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready