@@ -4,18 +4,27 @@
4Install with nginx
4Install with nginx
5==================
5==================
7−.. sidebar:: public HTTP servers
7+.. _nginx:
8−
8+ https://docs.nginx.com/nginx/admin-guide/
9− On public searx instances use an application firewall (:ref:`filtron
9+.. _nginx server configuration:
10− <filtron.sh>`).
10+ https://docs.nginx.com/nginx/admin-guide/web-server/web-server/#setting-up-virtual-servers
11+.. _nginx beginners guide:
12+ http://nginx.org/en/docs/beginners_guide.html
13+.. _Getting Started wiki:
14+ https://www.nginx.com/resources/wiki/start/
12.. contents:: Contents
16.. contents:: Contents
15 :backlinks: entry
19 :backlinks: entry
17−If nginx is not installed (uwsgi will not work with the package
25+If nginx_ is not installed (uwsgi will not work with the package nginx-light)
18−nginx-light):
26+install it now.
@@ -25,87 +34,208 @@ nginx-light):
26 sudo -H apt-get install nginx
35 sudo -H apt-get install nginx
28−Hosted at ``/``
37+ .. group-tab:: Arch Linux
31−Create the configuration file ``/etc/nginx/sites-available/searx`` with this
39+ .. code-block:: sh
34−.. code:: nginx
41+ sudo -H pacman -S nginx-mainline
42+ sudo -H systemctl enable nginx
43+ sudo -H systemctl start nginx
36− server {
45+ .. group-tab:: Fedora / RHEL
38− server_name searx.example.com;
39− root /usr/local/searx/searx;
41− location /static {
47+ .. code-block:: sh
44− location / {
49+ sudo -H dnf install nginx
45− include uwsgi_params;
50+ sudo -H systemctl enable nginx
46− uwsgi_pass unix:/run/uwsgi/app/searx/socket;
51+ sudo -H systemctl start nginx
50−Create a symlink to sites-enabled:
53+Now at http://localhost you should see a *Welcome to nginx!* page, on Fedora you
54+see a *Fedora Webserver - Test Page*. The test page comes from the default
55+`nginx server configuration`_:
52−.. code:: sh
57+.. tabs::
54− sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
59+ .. group-tab:: Ubuntu / debian
56−Restart service:
61+ .. code:: sh
63+ less /etc/nginx/nginx.conf
65+ there is a line including site configurations from:
69+ include /etc/nginx/sites-enabled/*;
71+ .. group-tab:: Arch Linux
75+ less /etc/nginx/nginx.conf
77+ in there is a configuration section named ``server``:
79+ .. code-block:: nginx
83+ server_name localhost;
87+ .. group-tab:: Fedora / RHEL
91+ less /etc/nginx/nginx.conf
93+ there is a line including site configurations from:
97+ include /etc/nginx/conf.d/*.conf;
104+.. sidebar:: public to the internet?
106+ If your searx instance is public, stop here and first install :ref:`filtron
107+ reverse proxy <filtron.sh>` and :ref:`result proxy morty <morty.sh>`, see
108+ :ref:`installation scripts`.
110+Now you have to create a configuration for the searx site. If nginx_ is new to
111+you, the `nginx beginners guide`_ is a good starting point and the `Getting
112+Started wiki`_ is always a good resource *to keep in the pocket*.
60 .. group-tab:: Ubuntu / debian
116 .. group-tab:: Ubuntu / debian
118+ Create configuration at ``/etc/nginx/sites-available/searx`` and place a
119+ symlink to sites-enabled:
62 .. code:: sh
121 .. code:: sh
64− sudo -H systemctl restart nginx
123+ sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
65− sudo -H systemctl restart uwsgi
67−from subdirectory URL (``/searx``)
125+ .. group-tab:: Arch Linux
68−==================================
70−Add this configuration in the server config file
127+ In the ``/etc/nginx/nginx.conf`` file, replace the configuration section
71−``/etc/nginx/sites-enabled/default``:
128+ named ``server``.
73−.. code:: nginx
130+ .. group-tab:: Fedora / RHEL
75− location /searx/static {
132+ Create configuration at ``/etc/nginx/conf.d/searx`` and place a
76− alias /usr/local/searx/searx/static;
133+ symlink to sites-enabled:
79− location /searx {
135+.. tabs::
80− uwsgi_param SCRIPT_NAME /searx;
81− include uwsgi_params;
82− uwsgi_pass unix:/run/uwsgi/app/searx/socket;
86−**OR** using reverse proxy (Please, note that reverse proxy advised to be used
138+ .. group-tab:: filtron at ``/`` & ``/morty``
87−in case of single-user or low-traffic instances.)
89−.. code:: nginx
140+ Use this setup, if your instance is public to the internet:
91− location /searx/static {
142+ .. code:: nginx
92− alias /usr/local/searx/searx/static;
95− location /searx {
144+ location / {
145+ proxy_set_header Host $http_host;
146+ proxy_set_header X-Real-IP $remote_addr;
147+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
148+ proxy_set_header X-Scheme $scheme;
96− proxy_pass http://127.0.0.1:8888;
149+ proxy_pass http://127.0.0.1:4004/;
97− proxy_set_header Host $host;
98− proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
99− proxy_set_header X-Scheme $scheme;
100− proxy_set_header X-Script-Name /searx;
101− proxy_buffering off;
104−Enable ``base_url`` in ``searx/settings.yml``
152+ .. code:: nginx
155+ proxy_set_header Host $http_host;
156+ proxy_set_header X-Real-IP $remote_addr;
157+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
158+ proxy_set_header X-Scheme $scheme;
159+ proxy_pass http://127.0.0.1:3000/;
162+ For a fully result proxification add :ref:`morty's <searx_morty>` public
163+ URL to your :origin:`searx/settings.yml`:
106−.. code:: yaml
165+ .. code:: yaml
168+ # replace searx.example.com with your server's public name
169+ url : http://searx.example.com/
172+ .. group-tab:: searx at ``/``
174+ Use this setup only, if your instance is **NOT** public to the internet:
182+ # replace searx.example.com with your server's public name
183+ server_name searx.example.com;
185+ root /usr/local/searx/searx;
191+ include uwsgi_params;
192+ uwsgi_pass unix:/run/uwsgi/app/searx/socket;
196+ .. group-tab:: searx at ``/searx``
198+ Use this setup only, if your instance is **NOT** public to the internet:
202+ location /searx/static {
203+ alias /usr/local/searx/searx/static;
207+ uwsgi_param SCRIPT_NAME /searx;
208+ include uwsgi_params;
209+ uwsgi_pass unix:/run/uwsgi/app/searx/socket;
213+ **OR** using reverse proxy. Please, note that reverse proxy advised to be
214+ used in case of single-user or low-traffic instances.
218+ location /searx/static {
219+ alias /usr/local/searx/searx/static;
223+ proxy_pass http://127.0.0.1:8888;
224+ proxy_set_header Host $host;
225+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
226+ proxy_set_header X-Scheme $scheme;
227+ proxy_set_header X-Script-Name /searx;
228+ proxy_buffering off;
231+ Enable ``base_url`` in :origin:`searx/settings.yml`
236+ # replace searx.example.com with your server's public name
237+ base_url : http://searx.example.com/searx/
108− base_url : http://your.domain.tld/searx/
110Restart service:
240Restart service:
@@ -118,24 +248,31 @@ Restart service:
118 sudo -H systemctl restart nginx
248 sudo -H systemctl restart nginx
119 sudo -H systemctl restart uwsgi
249 sudo -H systemctl restart uwsgi
251+ .. group-tab:: Arch Linux
122−disable logs
253+ .. code:: sh
125−For better privacy you can disable nginx logs about searx. How to proceed:
255+ sudo -H systemctl restart nginx
126−below ``uwsgi_pass`` in ``/etc/nginx/sites-available/default`` add:
256+ sudo -H systemctl restart uwsgi
128−.. code:: nginx
258+ .. group-tab:: Fedora
130− access_log /dev/null;
260+ .. code:: sh
131− error_log /dev/null;
133−Restart service:
262+ sudo -H systemctl restart nginx
263+ sudo -H systemctl restart uwsgi
137− .. group-tab:: Ubuntu / debian
266+Disable logs
139− .. code:: sh
269+For better privacy you can disable nginx logs in ``/etc/nginx/nginx.conf``.
141− sudo -H systemctl restart nginx
271+.. code:: nginx
275+ access_log /dev/null;
276+ error_log /dev/null;