nGinX HTTP-Code 200 / 404
mdounin at mdounin.ru
Tue Jan 10 10:25:04 UTC 2012
On Tue, Jan 10, 2012 at 09:42:45AM +0100, Maik Unger wrote:
> We have that problem, that a site is not reachable throught nginx with
> the domain name (for example www.foobar.org), even the websites are
> reachable without nginx directly to apache.
> This problem is not time specific, so that we have no solution at this
> What is the problem here?
Most likely you are using wrong config.
By default nginx will use hostname as specified in proxy_pass
will generate request with Host header set to "127.0.0.1:8080",
not to "www.foobar.org". Your backend server won't recognize it
if it's configured to serve many virtual hosts, and
"www.foobar.org" is just one of them.
To preserve the hostname from the original request (as sent to
nginx server), use
proxy_set_header Host $host;
More information about the nginx