Very wierd config error..

Maxim Dounin mdounin at mdounin.ru
Fri Apr 13 11:10:29 UTC 2012


Hello!

On Fri, Apr 13, 2012 at 07:02:45AM -0400, alexscott wrote:

> Hello!
> I'm sorry to bother the forum with these kind of questions, but I simply
> can't figure out what I'm doing wrong here:
> 
> When I access sub.domain.net/ I still get the 502 error instead of being
> served from the /somefolder/stuff folder?....
> 
> server {
> 	listen 80;
> 	server_name sub.domain.net;
> 
> location = / {
> root /somefolder/stuff;
> index index.html index.htm;
> 
> }
> 
> location / {
> 
> return 502;
> 
> }
> 
> }

Detailed explanation is given here:
http://nginx.org/en/docs/http/request_processing.html#simple_php_site_configuration

In short: request to "/" is internally redirected to 
"/index.html", and then handled in "location /".  Try this 
instead:

    root /somefolder/stuff;

    location = / {
        index index.html index.htm;
    }

    location = /index.html {
        internal;
    }

    location = /index.htm {
        internal;
    }

    location / {
        return 502;
    }

Maxim Dounin



More information about the nginx mailing list