Welcome! Log In Create A New Profile

Advanced

Re: Very wierd config error..

April 13, 2012 08:23AM
Maxim Dounin Wrote:
-------------------------------------------------------
> 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.h
> tml#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
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

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;
}
Subject Author Posted

Very wierd config error..

alexscott April 13, 2012 07:02AM

Re: Very wierd config error..

Maxim Dounin April 13, 2012 07:12AM

Re: Very wierd config error..

kolbyjack April 13, 2012 08:23AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 289
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