Very wierd config error

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;

}

}

Posted at Nginx Forum:

Hello!

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

}

}

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 D.

Maxim D. Wrote:

When I access sub.domain.net/ I still get the

Detailed explanation is given here:

}

nginx Info Page
You can also do this without adding new locations by using try_files
instead of index.

root /somefolder/stuff;

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

location / {
return 502;
}

Posted at Nginx Forum: