Serving a subdirectory

Francis Daly francis at daoine.org
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/ index.sh;
>     }
> 
>     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 index.sh is intended or not.

>         fastcgi_param SCRIPT_FILENAME $request_filename;

For testing, you could try to put 

  return 200 "in index.sh - $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/index.sh to fcgiwraper. /var/www/chrony/index.sh 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 https://github.com/gnosek/fcgiwrap/blob/master/fcgiwrap.c 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/index.sh when the request is for dir/",
then it might be enough to remove the try_files block, and fix the
index.sh line.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list