Serving a subdirectory

Francis Daly francis at
Thu Dec 5 15:02:00 UTC 2019

On Wed, Dec 04, 2019 at 07:08:52PM +0100, Thomas Schweikle wrote:

Hi there,

> I'm a little bit lost now, since various configurations tried just dont
> work. None of them.

I'm not quite clear on what specifically you want your nginx to do.

If it matters -- could you describe that?

>     location /chrony {
>         try_files $uri $uri/ $uri/;
>     }
>     location ~ "index\.sh"$ {

I suspect that some of this was re-typed from the config, rather than
having been copy-pasted.

The "$ probably should be $"; and I'm not sure if the space before
the is intended or not.

>         fastcgi_param SCRIPT_FILENAME $request_filename;

For testing, you could try to put 

  return 200 "in - $request_filename\n";

in this location{}. It will *not* invoke fastcgi, but it will show you
want filename nginx writes in the matching variable.

> If i am looking at the debug logs all seems OK: nginx feeds
> /var/www/chrony/ to fcgiwraper. /var/www/chrony/ is allowed
> to be executed by all. group is root, owner is root. Only the owner is
> allowed to write the file. All others are allowed to execute it.

I do not know if it is the same version that you are using, but the
code at looks
like it includes a "reason" message with a 403 code. That message might
indicate why the system thinks there is a problem.

> My first question: why doesn't nginx:

If you can show the config you are using, it may be clear why nginx does
what it does.

If what you want is "serve dir/ when the request is for dir/",
then it might be enough to remove the try_files block, and fix the line.

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list