nGinX HTTP-Code 200 / 404

Maxim Dounin mdounin at
Tue Jan 10 10:25:04 UTC 2012


On Tue, Jan 10, 2012 at 09:42:45AM +0100, Maik Unger wrote:

> Hy,
> We have that problem, that a site is not reachable throught nginx with
> the domain name (for example, even the websites are
> reachable without nginx directly to apache.
> This problem is not time specific, so that we have no solution at this
> moment.
> What is the problem here?

Most likely you are using wrong config.

By default nginx will use hostname as specified in proxy_pass 
directive, i.e.


will generate request with Host header set to "", 
not to "".  Your backend server won't recognize it 
if it's configured to serve many virtual hosts, and 
"" is just one of them.

To preserve the hostname from the original request (as sent to 
nginx server), use 

    proxy_set_header Host $host;

Maxim Dounin

More information about the nginx mailing list