searxng/docs/admin
Robin Schneider a1d9c81915
Fix Nginx subdir URL install docs which allowed download of settings.yml
Closes: #1617

There is an issue with the setup example in https://asciimoo.github.io/searx/dev/install/installation.html#installation for subdirectory URL deployments:

```nginx
root /usr/local/searx;

location = /searx { rewrite ^ /searx/; }
        try_files $uri @searx;
}
location @searx {
        uwsgi_param SCRIPT_NAME /searx;
        include uwsgi_params;
        uwsgi_modifier1 30;
        uwsgi_pass unix:/run/uwsgi/app/searx/socket;
}
```

`try_files` causes Nginx to search for files in the server root first. If it matches a file, it is returned. Only if no file matched, the request is passed to uwsgi. The worst consequence I can think of is that  `settings.yml` can be downloaded without authentication (where secrets and configuration details are stored).

To fix this, I propose:

```nginx
location = /searx {
        rewrite ^ /searx/;
}

location /searx/static {
}

location /searx {
        uwsgi_param SCRIPT_NAME /searx;
        include uwsgi_params;
        uwsgi_pass unix:/run/uwsgi/app/searx/socket;
}
```

And add

```
route-run = fixpathinfo:
```

to `/etc/uwsgi/apps-available/searx.ini` because `uwsgi_modifier1 30` is apparently deprecated. Ref: https://uwsgi-docs.readthedocs.io/en/latest/Changelog-2.0.11.html#fixpathinfo-routing-action

I assume this issue exists because some uwsgi upstream docs also use the `try_files` construct (at least I have seen this somewhere in the docs or somewhere else on the Internet but cannot find it right now again).

https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html#hosting-multiple-apps-in-the-same-process-aka-managing-script-name-and-path-info also warns about this:

> If used incorrectly a configuration like this may cause security problems. For your sanity’s sake, double-triple-quadruple check that your application files, configuration files and any other sensitive files are outside of the root of the static files.
2019-12-31 14:24:27 +01:00
..
api.rst doc: proofread of the all reST sources (no content change) 2019-12-12 19:20:56 +01:00
arch_public.dot doc: add 'Architecture' article to admin section 2019-12-22 14:05:33 +01:00
architecture.rst doc: add 'Architecture' article to admin section 2019-12-22 14:05:33 +01:00
buildhosts.rst docs(admin): add article 'Buildhosts' with system requirements 2019-12-28 01:25:16 +01:00
engines.rst doc: add reST templating // incl. generic engine tabe 2019-12-21 17:13:38 +01:00
filtron.rst doc: proofread of the all reST sources (no content change) 2019-12-12 19:20:56 +01:00
index.rst docs(admin): add article 'Buildhosts' with system requirements 2019-12-28 01:25:16 +01:00
installation.rst Fix Nginx subdir URL install docs which allowed download of settings.yml 2019-12-31 14:24:27 +01:00
morty.rst doc: proofread of the all reST sources (no content change) 2019-12-12 19:20:56 +01:00
plugins.rst doc: add plugin section to admin section (template) 2019-12-22 23:26:06 +01:00