Serving a subdirectory

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Serving a subdirectory

Thomas Schweikle
Hi!

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

I have:

server {
    listen 443 default_server ssl;
    listen [::]:443 default_server ssl;

    server_name nc409.my.domain;
    root /var/www;
    index index.sh index.html;

    location /chrony {
        try_files $uri $uri/ $uri/ index.sh;
    }

    location ~ "index\.sh"$ {
        gzip off;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
        include /etc/nginx/fastcgi_params;
        fastcgi_param DOCUMENT_ROOT $document_root;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }

}

With https://nc409.my.domain/ it gives an empty page (this is intended).
With https://nc409.my.domain/chrony it gives 404-not found.
With https://nc409.my.domain/chrony/ it gives 404-not found.
With https://nc409.my.domain/chrony/index.sh it gives 403 Forbidden.

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.

My first question: why doesn't nginx:

feeding index.sh to fcgiwraper and delivering index.css directly? And how do I have to set up this thing to do exactly that?


--
Thomas

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Serving a subdirectory

Francis Daly
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        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Serving a subdirectory

Thomas Schweikle
Configuration
/etc/nginx/sites-available:
chrony
default

/etc/nginx/sites-available/chrony:
server {
    listen 443 default_server ssl;
    listen [::]:443 default_server ssl;

    server_name <server fqdn>;
    root /var/www/chrony;
    index index.sh index.html;

    location /chrony {
        try_files $uri $uri/ $uri/index.sh;
    }

    location ~ "index\.sh"$ {
        gzip off;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
        include /etc/nginx/fastcgi_params;
        fastcgi_param DOCUMENT_ROOT $document_root;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }


/etc/nginx/sites-available/default:
server {                                                                                                                            
        listen 80 default_server;                                                                                                  
        listen [::]:80 default_server;                                                                                              

        root /var/www/html;
        index index.html index.htm index.nginx-debian.html;                                                                        

        server_name _;                                                                                                              

        location / {                                                                                                                
                try_files $uri $uri/ =404;
        }
}

/etc/nginx/nginx.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
}

http {
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
        gzip on;
        gzip_disable "msie6";
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

Filesystem:
/var/www/html/index.nginx-debian.html
/var/www/chrony/index.sh
/var/www/chrony/chrony.css

For https://<fqdn-server>/:
nginx default site delivered ok.

For https://<fqdn-server>/chrony:
404 - Not found. 


Versions:
ii  fcgiwrap                              1.1.0-9                           armhf        simple server to run CGI applications over FastCGI
ii  libfcgi-bin                           2.4.0-8.4                         armhf        FastCGI bridge from CGI
ii  libfcgi0ldbl:armhf                    2.4.0-8.4                         armhf        Shared library of FastCGI
ii  libnginx-mod-http-auth-pam            1.10.3-1+deb9u3                   armhf        PAM authentication module for Nginx
ii  libnginx-mod-http-dav-ext             1.10.3-1+deb9u3                   armhf        WebDAV missing commands support for Nginx
ii  libnginx-mod-http-echo                1.10.3-1+deb9u3                   armhf        Bring echo and more shell style goodies to Nginx
ii  libnginx-mod-http-geoip               1.10.3-1+deb9u3                   armhf        GeoIP HTTP module for Nginx
ii  libnginx-mod-http-image-filter        1.10.3-1+deb9u3                   armhf        HTTP image filter module for Nginx
ii  libnginx-mod-http-subs-filter         1.10.3-1+deb9u3                   armhf        Substitution filter module for Nginx
ii  libnginx-mod-http-upstream-fair       1.10.3-1+deb9u3                   armhf        Nginx Upstream Fair Proxy Load Balancer
ii  libnginx-mod-http-xslt-filter         1.10.3-1+deb9u3                   armhf        XSLT Transformation module for Nginx
ii  libnginx-mod-mail                     1.10.3-1+deb9u3                   armhf        Mail module for Nginx
ii  libnginx-mod-stream                   1.10.3-1+deb9u3                   armhf        Stream module for Nginx
ii  nginx                                 1.10.3-1+deb9u3                   all          small, powerful, scalable web/proxy server
ii  nginx-common                          1.10.3-1+deb9u3                   all          small, powerful, scalable web/proxy server - common files
ii  nginx-full                            1.10.3-1+deb9u3                   armhf        nginx web/proxy server (standard version)

On Thu, Dec 5, 2019 at 4:02 PM Francis Daly <[hidden email]> wrote:
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        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


--
Thomas

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Serving a subdirectory

Francis Daly
On Fri, Dec 06, 2019 at 12:39:59PM +0100, Thomas Schweikle wrote:

Hi there,

This config fails to run for me.

So, unless something very strange is happening, this is not the config
that your running nginx is actually using.

>     location ~ "index\.sh"$ {

$ sbin/nginx -t
nginx: [emerg] unexpected "$" in /usr/local/nginx/conf/nginx.conf:19
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
$ sed -n 19p /usr/local/nginx/conf/nginx.conf
    location ~ "index\.sh"$ {

Changing that line to be

    location ~ "index\.sh$" {

allows it to run.

> For https://<fqdn-server>/:
> nginx default site delivered ok.

Your provided config says that that should serve something from
/var/www/chrony. You seem to report that it is serving something from
/var/www/html.

> For https://<fqdn-server>/chrony:
> 404 - Not found.

Your provided config says that that should serve something from
/var/www/chrony/chrony, which I think you show does not exist, so 404
is correct.

But I suspect that your actual running config is trying to serve something
from /var/www/html/chrony, which also does not exist, so 404 is created.


I think that you will need to identify the actual running config,
because that will make it easier to make the changes that you want.

Cheers,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Serving a subdirectory

Thomas Schweikle
OK. Trying with a completely different question:

My server serves /var/www/html directory-content as static pages to http://<server>/

How do I have to set it up to additionally serve http://<server>/chrony from /var/www/chrony?

I've tried with:
server {
    listen 443 default_server ssl;
    listen [::]:443 default_server ssl;

    server_name nc409-muc.bfs.de;
    root /var/www/chrony;
    index index.sh index.html;

    location / {
        try_files $uri $uri/ $uri/index.sh;
    }

    location ~ "index\.sh$" {
        gzip off;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
        include /etc/nginx/fastcgi_params;
        fastcgi_param DOCUMENT_ROOT $document_root;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }
}

But this leads to error 404 - not found.


I've tried with:
server {
    listen 443 default_server ssl;
    listen [::]:443 default_server ssl;

    server_name nc409-muc.bfs.de;
    root /var/www;
    index index.sh index.html;

    location /chrony {
        try_files $uri $uri/ $uri/index.sh;
    }

    location ~ "index\.sh$" {
        gzip off;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
        include /etc/nginx/fastcgi_params;
        fastcgi_param DOCUMENT_ROOT $document_root;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }
}

But this also lead to error - 404 - not found.

I did not have success with:
server {
    listen 443 default_server ssl;
    listen [::]:443 default_server ssl;

    server_name nc409-muc.bfs.de;
    root /var/www/chrony;
    index index.sh index.html;

    location ~ "index\.sh$" {
        gzip off;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
        include /etc/nginx/fastcgi_params;
        fastcgi_param DOCUMENT_ROOT $document_root;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }
}

lead to 404 - not found.

or

server {
    listen 443 default_server ssl;
    listen [::]:443 default_server ssl;

    server_name nc409-muc.bfs.de;
    root /var/www/chrony;
    index index.sh index.html;

    location ~ "index\.sh$" {
        gzip off;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
        include /etc/nginx/fastcgi_params;
        fastcgi_param DOCUMENT_ROOT $document_root;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }
}

lead to 404 - not found.

But the file is there:
/var/www:
insgesamt 16
drwxr-xr-x  4 root root 4096 Dez  2 16:25 .
drwxr-xr-x 12 root root 4096 Aug 20 12:58 ..
drwxr-xr-x  2 root root 4096 Dez  4 17:17 chrony
drwxr-xr-x  2 root root 4096 Aug 20 12:58 html

/var/www/chrony:
insgesamt 16
drwxr-xr-x 2 root root 4096 Dez  4 17:17 .
drwxr-xr-x 4 root root 4096 Dez  2 16:25 ..
-rw-r--r-- 1 root root   95 Dez  3 13:42 chrony.css
-rwxr-xr-x 1 root root 1712 Dez  3 16:07 index.sh

/var/www/html:
insgesamt 12
drwxr-xr-x 2 root root 4096 Aug 20 12:58 .
drwxr-xr-x 4 root root 4096 Dez  2 16:25 ..
-rw-r--r-- 1 root root  612 Aug 20 12:58 index.nginx-debian.html

and nginx -T does:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

With configuration:
# configuration file /etc/nginx/nginx.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
# multi_accept on;
}

http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

load_module modules/ngx_http_auth_pam_module.so;
load_module modules/ngx_http_dav_ext_module.so;
load_module modules/ngx_http_echo_module.so;
load_module modules/ngx_http_geoip_module.so;
load_module modules/ngx_http_image_filter_module.so;
load_module modules/ngx_http_subs_filter_module.so;
load_module modules/ngx_http_upstream_fair_module.so;
load_module modules/ngx_http_xslt_filter_module.so;
load_module modules/ngx_mail_module.so;
load_module modules/ngx_stream_module.so;

types {
    text/html                             html htm shtml;
    text/css                              css;
    text/xml                              xml;
    image/gif                             gif;
    image/jpeg                            jpeg jpg;
    application/javascript                js;
    application/atom+xml                  atom;
    application/rss+xml                   rss;

    text/mathml                           mml;
    text/plain                            txt;
    text/vnd.sun.j2me.app-descriptor      jad;
    text/vnd.wap.wml                      wml;
    text/x-component                      htc;

    image/png                             png;
    image/tiff                            tif tiff;
    image/vnd.wap.wbmp                    wbmp;
    image/x-icon                          ico;
    image/x-jng                           jng;
    image/x-ms-bmp                        bmp;
    image/svg+xml                         svg svgz;
    image/webp                            webp;

    application/font-woff                 woff;
    application/java-archive              jar war ear;
    application/json                      json;
    application/mac-binhex40              hqx;
    application/msword                    doc;
    application/pdf                       pdf;
    application/postscript                ps eps ai;
    application/rtf                       rtf;
    application/vnd.apple.mpegurl         m3u8;
    application/vnd.ms-excel              xls;
    application/vnd.ms-fontobject         eot;
    application/vnd.ms-powerpoint         ppt;
    application/vnd.wap.wmlc              wmlc;
    application/vnd.google-earth.kml+xml  kml;
    application/vnd.google-earth.kmz      kmz;
    application/x-7z-compressed           7z;
    application/x-cocoa                   cco;
    application/x-java-archive-diff       jardiff;
    application/x-java-jnlp-file          jnlp;
    application/x-makeself                run;
    application/x-perl                    pl pm;
    application/x-pilot                   prc pdb;
    application/x-rar-compressed          rar;
    application/x-redhat-package-manager  rpm;
    application/x-sea                     sea;
    application/x-shockwave-flash         swf;
    application/x-stuffit                 sit;
    application/x-tcl                     tcl tk;
    application/x-x509-ca-cert            der pem crt;
    application/x-xpinstall               xpi;
    application/xhtml+xml                 xhtml;
    application/xspf+xml                  xspf;
    application/zip                       zip;

    application/octet-stream              bin exe dll;
    application/octet-stream              deb;
    application/octet-stream              dmg;
    application/octet-stream              iso img;
    application/octet-stream              msi msp msm;

    application/vnd.openxmlformats-officedocument.wordprocessingml.document    docx;
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet          xlsx;
    application/vnd.openxmlformats-officedocument.presentationml.presentation  pptx;

    audio/midi                            mid midi kar;
    audio/mpeg                            mp3;
    audio/ogg                             ogg;
    audio/x-m4a                           m4a;
    audio/x-realaudio                     ra;

    video/3gpp                            3gpp 3gp;
    video/mp2t                            ts;
    video/mp4                             mp4;
    video/mpeg                            mpeg mpg;
    video/quicktime                       mov;
    video/webm                            webm;
    video/x-flv                           flv;
    video/x-m4v                           m4v;
    video/x-mng                           mng;
    video/x-ms-asf                        asx asf;
    video/x-ms-wmv                        wmv;
    video/x-msvideo                       avi;
}

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name _;

    return 301 https://$host$request_uri;
}

server {
    listen 443 default_server ssl;
    listen [::]:443 default_server ssl;

    server_name _;

    ssl_certificate      /etc/ssl/certs/nginx.crt;
    ssl_certificate_key  /etc/ssl/private/nginx.key;

    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

    location /chrony {
        root /var/www/chrony;
        try_files $uri $uri/ $uri/index.sh;
    }

    location ~ "index\.sh$" {
        gzip off;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
        include /etc/nginx/fastcgi_params;
        fastcgi_param DOCUMENT_ROOT $document_root;
        fastcgi_param SCRIPT_FILENAME $request_filename;
    }
}


# configuration file /etc/nginx/fastcgi_params:

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;


On Fri, Dec 6, 2019 at 1:29 PM Francis Daly <[hidden email]> wrote:
On Fri, Dec 06, 2019 at 12:39:59PM +0100, Thomas Schweikle wrote:

Hi there,

This config fails to run for me.

So, unless something very strange is happening, this is not the config
that your running nginx is actually using.

>     location ~ "index\.sh"$ {

$ sbin/nginx -t
nginx: [emerg] unexpected "$" in /usr/local/nginx/conf/nginx.conf:19
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
$ sed -n 19p /usr/local/nginx/conf/nginx.conf
    location ~ "index\.sh"$ {

Changing that line to be

    location ~ "index\.sh$" {

allows it to run.

> For https://<fqdn-server>/:
> nginx default site delivered ok.

Your provided config says that that should serve something from
/var/www/chrony. You seem to report that it is serving something from
/var/www/html.

> For https://<fqdn-server>/chrony:
> 404 - Not found.

Your provided config says that that should serve something from
/var/www/chrony/chrony, which I think you show does not exist, so 404
is correct.

But I suspect that your actual running config is trying to serve something
from /var/www/html/chrony, which also does not exist, so 404 is created.


I think that you will need to identify the actual running config,
because that will make it easier to make the changes that you want.

Cheers,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


--
Thomas

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Serving a subdirectory

Francis Daly
On Fri, Dec 06, 2019 at 04:47:08PM +0100, Thomas Schweikle wrote:

Hi there,

> OK. Trying with a completely different question:
>
> My server serves /var/www/html directory-content as static pages to http://
> <server>/
>
> How do I have to set it up to additionally serve http://<server>/chrony
> from /var/www/chrony?

  location /chrony/ {
    root /var/www;
  }

Although I would probably really use "location ^~ /chrony/ {".

And that is all you need, in the "common" case.


Separate from that, since you want to do special handling of "index.sh"
within "/chrony/", I would suggest nesting the location, like so:

  location ^~ /chrony/ {
    root /var/www;
    location ~ index\.sh$ {
      fastcgi_pass unix:/var/run/fcgiwrap.socket;
    }
  }

You will want

  index index.sh index.html;

somewhere. You probably will not want the try_files line that you have.

And you can put the

  include /etc/nginx/fastcgi_params;

and fastcgi_param lines together somewhere -- inside this location{},
or in somewhere that will inherit in to it. The "best" place depends on
what else the server config is doing -- do you, for example, want to
handle /xxx/index.sh as well as /chrony/index.sh?


> I've tried with:

>     root /var/www/chrony;

That will cause the request /chrony to look for /var/www/chrony/chrony.

> But this leads to error 404 - not found.

>     root /var/www;
>     index index.sh index.html;
>
>     location /chrony {
>         try_files $uri $uri/ $uri/index.sh;
>     }
>
>     location ~ "index\.sh$" {
>         gzip off;
>         fastcgi_pass unix:/var/run/fcgiwrap.socket;
>         include /etc/nginx/fastcgi_params;
>         fastcgi_param DOCUMENT_ROOT $document_root;
>         fastcgi_param SCRIPT_FILENAME $request_filename;
>     }

That looks to me like it probably should work. At least for the requests
/chrony and /chrony/ -- anything like /chrony/x will probably fail.

> But this also lead to error - 404 - not found.

>     root /var/www/chrony;

Again, that will cause the request /chrony to look for /var/www/chrony/chrony.

> lead to 404 - not found.

>     root /var/www/chrony;

Same.

> lead to 404 - not found.

> /var/www/chrony:
> insgesamt 16
> drwxr-xr-x 2 root root 4096 Dez  4 17:17 .
> drwxr-xr-x 4 root root 4096 Dez  2 16:25 ..
> -rw-r--r-- 1 root root   95 Dez  3 13:42 chrony.css
> -rwxr-xr-x 1 root root 1712 Dez  3 16:07 index.sh

Most of the above configs are looking for /var/www/chrony/chrony/index.sh.

>     root /var/www/html;
>     index index.html index.htm index.nginx-debian.html;
>
>     location / {
>         # First attempt to serve request as file, then
>         # as directory, then fall back to displaying a 404.
>         try_files $uri $uri/ =404;

As it happens, that description (and configuration) is pretty much
what happens when try_files is not used. So you can probably just omit
that line.

>     location /chrony {
>         root /var/www/chrony;

  root /var/www;

>         try_files $uri $uri/ $uri/index.sh;

The final argument to try_files is a url that must exist; it is not
a file to try. So if you request /chrony/x, this will do an internal
redirect to /chrony/x/index.sh.

You are probably better off including "index.sh" in the "index" directive,
and omitting this try_files line too.

>     location ~ "index\.sh$" {
>         gzip off;
>         fastcgi_pass unix:/var/run/fcgiwrap.socket;
>         include /etc/nginx/fastcgi_params;
>         fastcgi_param DOCUMENT_ROOT $document_root;
>         fastcgi_param SCRIPT_FILENAME $request_filename;

If the request here is /chrony/index.sh, then $document_root is
/var/www/html and $request_filename is /var/www/html/chrony/index.sh.

In nginx, one request is handled in one location{}. Only the config in,
or inherited into, that location matters.

You do not set "root" in this location; therefore the inherited value
is /var/www/html.

If this location is only intended to handle things below /chrony,
set root explicitly; or set root implicitly by nesting it inside the
location that does set root appropriately.

Good luck with it,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx