Searx是一个免费的互联网元搜索引擎,汇集了70多种搜索服务的结果。 用户既不被跟踪也不被分析。 此外,searx可以在Tor上实现在线匿名搜索。
下面是基于 Debian/Ubuntu 和 virtualenv 的安装指南,如果是 Ubuntu 请确认使用的是 universe 仓库。
安装依赖包:
sudo apt-get install git build-essential libxslt-dev python-dev python-virtualenv python-babel zlib1g-dev libffi-dev libssl-dev
安装 searx:
cd /usr/local sudo git clone https://github.com/asciimoo/searx.git sudo useradd searx -d /usr/local/searx sudo chown searx:searx -R /usr/local/searx
在 virtualenv 中安装依赖:
sudo -u searx -i cd /usr/local/searx virtualenv searx-ve . ./searx-ve/bin/activate ./manage.sh update_packages
sed -i -e "s/ultrasecretkey/`openssl rand -hex 16`/g" searx/settings.yml
根据需要修改 searx/settings.yml
启动 searx:
python searx/webapp.py
浏览器访问 http://localhost:8888
如果一切工作正常,可以在 settings.yml 中禁用调试选项:
sed -i -e "s/debug : True/debug : False/g" searx/settings.yml
安装依赖包
sudo apt-get install uwsgi uwsgi-plugin-python
创建配置文件 /etc/uwsgi/apps-available/searx.ini,内容如下:
[uwsgi] # Who will run the code uid = searx gid = searx # disable logging for privacy disable-logging = true # Number of workers (usually CPU count) workers = 4 # The right granted on the created socket chmod-socket = 666 # Plugin to use and interpretor config single-interpreter = true master = true plugin = python lazy-apps = true enable-threads = true # Module to import module = searx.webapp # Virtualenv and python path virtualenv = /usr/local/searx/searx-ve/ pythonpath = /usr/local/searx/ chdir = /usr/local/searx/searx/
激活 uwsgi 应用并重启
cd /etc/uwsgi/apps-enabled ln -s ../apps-available/searx.ini /etc/init.d/uwsgi restart
使用如下命令安装 Nginx
sudo apt-get install nginx
创建配置文件 /etc/nginx/sites-available/searx 内容如下:
server { listen 80; server_name searx.example.com; root /usr/local/searx; location / { include uwsgi_params; uwsgi_pass unix:/run/uwsgi/app/searx/socket; } }
重启服务:
sudo service nginx restart sudo service uwsgi restart
添加配置文件 /etc/nginx/sites-enabled/default 内容如下:
location = /searx { rewrite ^ /searx/; } location /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; }
或者使用反向代理(适合单用户使用或者低访问量的实例)
location /searx { proxy_pass http://127.0.0.1:8888; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; proxy_set_header X-Script-Name /searx; proxy_buffering off; }
编辑 searx/settings.xml 中的 base_url
base_url : http://your.domain.tld/searx/
为了更好的保护隐私,可以禁用日志,在 /etc/nginx/sites-available/default 的 uwsgi_pass 下面增加如下内容:
uwsgi_pass
access_log /dev/null; error_log /dev/null;
重启服务
sudo service nginx restart
增加 wsgi mod:
sudo apt-get install libapache2-mod-uwsgi sudo a2enmod uwsgi
增加配置内容到 /etc/apache2/apache2.conf:
<Location /> Options FollowSymLinks Indexes SetHandler uwsgi-handler uWSGISocket /run/uwsgi/app/searx/socket </Location>
N注意,如果你的 searx 实例不是部署在根路径,需要修改 <Location /> 配置信息,如 <Location /searx>.
<Location />
<Location /searx>
重启 Apache:
sudo /etc/init.d/apache2 restart
回到配置文件 /etc/apache2/apache2.conf 在 <Location /> 指令上方增加:
CustomLog /dev/null combined
cd /usr/local/searx sudo -u searx -i . ./searx-ve/bin/activate git stash git pull origin master git stash apply ./manage.sh update_packages sudo service uwsgi restart
确认你已装有 Docker ,然后使用如下命令来部署 searx:
docker pull wonderfall/searx docker run -d --name searx -p $PORT:8888 wonderfall/searx
打开浏览器访问 http://localhost:$PORT.
更多的帮助请看 https://hub.docker.com/r/wonderfall/searx/
你也可以通过 Dockerfile 来构建 searx
git clone https://github.com/asciimoo/searx.git cd searx docker build -t whatever/searx .
https://about.okhin.fr/posts/Searx/ with some additions How to: Setup searx in a couple of hours with a free SSL certificate