I have a site that is completely static and I figured I would use
try-files however this results in HTTP 500 errors for directories i.e.
trying to get to http://foo.com/bar/ results in a 500 error. What's
wrong with this config? Thanks.
charset utf-8;
# sets the domain[s] that this vhost server requests for
server-name www.foo.com;
# doc root
root /var/www/foo.com;
# vhost specific access log
access-log /var/log/nginx-access.log main;
# Catchall for everything else
location / {
root /var/www/foo.com;
access-log off;
index index.html index.shtml;
expires 1d;
try-files $uri $uri/;
#if (-f $request-filename) {
# break;
#}
}
error-page 500 502 503 504 /500.html;
error-page 404 /404.html;
}
Re: try_files and static web site by Michael Shadle on
2009-07-07T06:00:17+00:00
I see no reason to be using try-files at all in your config.
Sent from my iPhone
On Jul 6, 2009, at 10:33 PM, Jauder Ho <lists@ruby-forum.com> wrote:
> I have a site that is completely static and I figured I would use
> try-files however this results in HTTP 500 errors for directories i.e.
> trying to get to http://foo.com/bar/ results in a 500 error. What's
> wrong with this config? Thanks.
>
> > charset utf-8;
>
> # sets the domain[s] that this vhost server requests for
> server-name www.foo.com;
>
> # doc root
> root /var/www/foo.com;
>
> # vhost specific access log
> access-log /var/log/nginx-access.log main;
>
>
> # Catchall for everything else
> location / {
> root /var/www/foo.com;
> access-log off;
>
> index index.html index.shtml;
> expires 1d;
>
> try-files $uri $uri/;
>
> #if (-f $request-filename) {
> # break;
> #}
> }
>
>
>
> error-page 500 502 503 504 /500.html;
> error-page 404 /404.html;
>
> }
>