searxng / searxng

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
https://docs.searxng.org
GNU Affero General Public License v3.0
14.22k stars 1.48k forks source link

Documentation has a mistake on location of socket that breaks uWSGI and nginx, on Debian 12 #3544

Closed rjc3rd closed 5 months ago

rjc3rd commented 5 months ago

First of all, I want to say that the webapp was working the entire time. The problem is only with the documentation and most likely only for Debian 12, but that's only a guess on my part, since I'm only trying to run it on Debian 12. Although, I couldn't get it to work on my local machine either, which is Linux Mint. I just didn't trouble shoot it on my local machine at all, and I don't plan to.

In the documentation for uWSGI... https://docs.searxng.org/admin/installation-uwsgi.html

And in the documentation for nginx... https://docs.searxng.org/admin/installation-nginx.html

And in the documentation for apache https://docs.searxng.org/admin/installation-apache.html

At least for me, on Debian 12, /usr/local/searxng/run/socket does not exist.

The correct location is... /run/uwsgi/app/searxng/socket

I've been spinning my wheels for a couple of days now.

Honestly I didn't really know how the web server was supposed to demonize the webapp from what was written in the documentation at the bottom of the page... https://docs.searxng.org/admin/installation-searxng.html "At this point SearXNG is not demonized; uwsgi allows this."

I didn't know how uWSGI was able to run the as user searxng, and didn't know how to make it work. This process has taught me quite a bit and I'm kind of alright with the process I went through here. I did learn some things.

I want to provide my conf files here in the hopes that others can get their SearXNG instance up and running.

/etc/uwsgi/apps-available/searxng.ini

[uwsgi] uid = searxng gid = searxng env = LANG=C.UTF-8 env = LANGUAGE=C.UTF-8 env = LC_ALL=C.UTF-8 disable-logging = true chmod-socket = 666 single-interpreter = true master = true lazy-apps = true plugin = python3,http enable-threads = true workers = %k threads = 4 module = searx.webapp chdir = /usr/local/searxng/searxng-src/searx virtualenv = /usr/local/searxng/searx-pyenv pythonpath = /usr/local/searxng/searxng-src env = SEARXNG_SETTINGS_PATH=/etc/searxng/settings.yml socket = /run/uwsgi/app/searxng/socket buffer-size = 8192 static-map = /static=/usr/local/searxng/searxng-src/searx/static static-expires = /* 86400 static-gzip-all = True offload-threads = %k

/etc/nginx/sites-available/searxng.conf

server { listen 80; server_name searxng.vm; return 302 https://$server_name$request_uri; } server { listen 443 ssl; include snippets/self-signed.conf; server_name searxng.vm; location / { include uwsgi_params; uwsgi_pass unix:/run/uwsgi/app/searxng/socket; } }

https://www.howtogeek.com/devops/how-to-create-and-use-self-signed-ssl-on-nginx/ I followed directions from this site to install self-signed SSL in case anyone wants to add this for local instance inside your own network.

rjc3rd commented 5 months ago

By the way, I tried the script first and it also failed when trying to restart the nginx server. I could see the red failure message go by while the script was running.

rjc3rd commented 5 months ago

@unixfox

At least for me, on Debian 12, /usr/local/searxng/run/socket does not exist.

The correct location is... /run/uwsgi/app/searxng/socket

I would request that you try to follow the directions on your wiki and install on Debian 12.

It's broken.

Plus the script can not run on Debian 12 because the socket is not where you link to it.

return42 commented 5 months ago

TLDR: /usr/local/searxng + /run/socket is the correct name of the path ..

Plus the script can not run on Debian 12 because the socket is not where you link to it.

I don't know why, but something must be going wrong with your installation .. all components are installed under the $SERVICE_HOME:

https://github.com/searxng/searxng/blob/f5eb56b63f250c7804e5e1cf4426e550bc933906/utils/searxng.sh#L17

The correct location is... /run/uwsgi/app/searxng/socket

If you installed with socket, the socket is located at /usr/local/searxng + /run/socket:

https://github.com/searxng/searxng/blob/f5eb56b63f250c7804e5e1cf4426e550bc933906/utils/searxng.sh#L29-L30

This folder is created in the scripts (may we missed to document it in the uWSGI installation description):

https://github.com/searxng/searxng/blob/f5eb56b63f250c7804e5e1cf4426e550bc933906/utils/searxng.sh#L610-L612

I want to provide my conf files here in the hopes that others can get their SearXNG instance up and running. ... env = SEARXNG_SETTINGS_PATH=/etc/searxng/settings.yml socket = /run/uwsgi/app/searxng/socket ..

And ${SEARXNG_UWSGI_SOCKET} (/usr/local/searxng/run/socket) is replaced in the wsgi-INI template

https://github.com/searxng/searxng/blob/f5eb56b63f250c7804e5e1cf4426e550bc933906/utils/templates/etc/uwsgi/apps-available/searxng.ini%3Asocket#L75