From 12dbc172476dde6db5f7929491d81fc59aa80432 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Fri, 13 Nov 2020 08:49:29 +0100 Subject: [PATCH] configure searx on uWSGI --- configuration.nix | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/configuration.nix b/configuration.nix index fbb12e9..7fb941a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -266,9 +266,24 @@ services.searx = { enable = true; environmentFile = config.secrets.searx.environment; + + # Use nginx+uWSGI + runInUwsgi = true; + uwsgiConfig = { + disable-logging = true; + + # serve via uwsgi unix socket + socket = "/run/searx/uwsgi.sock"; + chmod-socket = "660"; + + # mount app on non-root url /srx + manage-script-name = true; + module = ""; + mount = "/srx=searx.webapp:application"; + }; + settings = { general.instance_name = "searxwell"; - server.port = 8083; server.base_url = "https://${config.var.hostname}/srx/"; # Replace DOI links with Sci-Hub @@ -289,6 +304,10 @@ }; }; + # Allow nginx access to the uwsgi socket + users.groups."searx".members = [ "nginx" ]; + + ### Reverse Proxy services.nginx = with config.var; @@ -340,15 +359,13 @@ }; # Searx instance - locations."/srx/" = { - proxyPass = "http://localhost:8083/"; - extraConfig = '' - proxy_set_header X-Scheme $scheme; - proxy_set_header X-Script-Name /srx/; - proxy_buffering off; + locations."/srx/".extraConfig = + '' + include ${pkgs.nginx}/conf/uwsgi_params; + uwsgi_pass unix:/run/searx/uwsgi.sock; ''; - }; - + locations."/srx/static/".alias = "${pkgs.searx}/share/static/"; + # Git server locations."/git/".proxyPass = "http://localhost:3000/"; @@ -371,7 +388,7 @@ # The Cactalogue virtualHosts."cacta.bit" = { - locations."/".alias = "/home/giu/cactalogue/"; + root = "/home/giu/cactalogue/"; extraConfig = disableLog; }; };