searx/admin/installation-nginx.html

511 lines
31 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Install with nginx &#8212; Searx Documentation (Searx-0.18.0.tex)</title>
<link rel="stylesheet" href="../_static/searx.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx_tabs/semantic-ui-2.4.1/segment.min.css" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx_tabs/semantic-ui-2.4.1/menu.min.css" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx_tabs/semantic-ui-2.4.1/tab.min.css" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx_tabs/tabs.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<script src="../_static/sphinx_tabs/semantic-ui-2.4.1/tab.min.js"></script>
<script src="../_static/sphinx_tabs/tabs.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Install with apache" href="installation-apache.html" />
<link rel="prev" title="uwsgi" href="installation-uwsgi.html" />
<script>DOCUMENTATION_OPTIONS.URL_ROOT = '../';</script>
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="installation-apache.html" title="Install with apache"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="installation-uwsgi.html" title="uwsgi"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Searx Documentation (Searx-0.18.0.tex)</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Administrator documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Install with nginx</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="install-with-nginx">
<span id="installation-nginx"></span><h1>Install with nginx<a class="headerlink" href="#install-with-nginx" title="Permalink to this headline"></a></h1>
<div class="sidebar">
<p class="sidebar-title">further reading</p>
<ul class="simple">
<li><p><a class="reference external" href="https://docs.nginx.com/nginx/admin-guide/">nginx</a></p></li>
<li><p><a class="reference external" href="https://nginx.org/en/docs/beginners_guide.html">nginx beginners guide</a></p></li>
<li><p><a class="reference external" href="https://docs.nginx.com/nginx/admin-guide/web-server/web-server/#setting-up-virtual-servers">nginx server configuration</a></p></li>
<li><p><a class="reference external" href="https://www.nginx.com/resources/wiki/start/">Getting Started wiki</a></p></li>
<li><p><a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html">uWSGI support from nginx</a></p></li>
</ul>
</div>
<div class="contents local topic" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#the-nginx-http-server" id="id1">The nginx HTTP server</a></p></li>
<li><p><a class="reference internal" href="#a-nginx-searx-site" id="id2">A nginx searx site</a></p></li>
<li><p><a class="reference internal" href="#disable-logs" id="id3">Disable logs</a></p></li>
</ul>
</div>
<hr class="docutils" />
<p><strong>Install</strong> <a class="reference internal" href="#nginx-searx-site"><span class="std std-ref">A nginx searx site</span></a> using <a class="reference internal" href="../utils/filtron.sh.html#filtron-sh-overview"><span class="std std-ref">filtron.sh</span></a></p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/filtron.sh nginx install
</pre></div>
</div>
<p><strong>Install</strong> <a class="reference internal" href="#nginx-searx-site"><span class="std std-ref">A nginx searx site</span></a> using <a class="reference internal" href="../utils/morty.sh.html#morty-sh-overview"><span class="std std-ref">morty.sh</span></a></p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/morty.sh nginx install
</pre></div>
</div>
<hr class="docutils" />
<div class="section" id="the-nginx-http-server">
<h2><a class="toc-backref" href="#id1">The nginx HTTP server</a><a class="headerlink" href="#the-nginx-http-server" title="Permalink to this headline"></a></h2>
<p>If <a class="reference external" href="https://docs.nginx.com/nginx/admin-guide/">nginx</a> is not installed (uwsgi will not work with the package nginx-light),
install it now.</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-VWJ1bnR1IC8gZGViaWFu docutils container">
<div class="docutils container">
<p>Ubuntu / debian</p>
</div>
</div>
<div class="item sphinx-data-tab-QXJjaCBMaW51eA== docutils container">
<div class="docutils container">
<p>Arch Linux</p>
</div>
</div>
<div class="item sphinx-data-tab-RmVkb3JhIC8gUkhFTA== docutils container">
<div class="docutils container">
<p>Fedora / RHEL</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-VWJ1bnR1IC8gZGViaWFu active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H apt-get install nginx
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-QXJjaCBMaW51eA== docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H pacman -S nginx-mainline
sudo -H systemctl <span class="nb">enable</span> nginx
sudo -H systemctl start nginx
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-RmVkb3JhIC8gUkhFTA== docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H dnf install nginx
sudo -H systemctl <span class="nb">enable</span> nginx
sudo -H systemctl start nginx
</pre></div>
</div>
</div>
</div>
<p>Now at <a class="reference external" href="http://localhost">http://localhost</a> you should see a <em>Welcome to nginx!</em> page, on Fedora you
see a <em>Fedora Webserver - Test Page</em>. The test page comes from the default
<a class="reference external" href="https://docs.nginx.com/nginx/admin-guide/web-server/web-server/#setting-up-virtual-servers">nginx server configuration</a>. How this default intro site is configured,
depends on the linux distribution:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-VWJ1bnR1IC8gZGViaWFu docutils container">
<div class="docutils container">
<p>Ubuntu / debian</p>
</div>
</div>
<div class="item sphinx-data-tab-QXJjaCBMaW51eA== docutils container">
<div class="docutils container">
<p>Arch Linux</p>
</div>
</div>
<div class="item sphinx-data-tab-RmVkb3JhIC8gUkhFTA== docutils container">
<div class="docutils container">
<p>Fedora / RHEL</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-VWJ1bnR1IC8gZGViaWFu active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>less /etc/nginx/nginx.conf
</pre></div>
</div>
<p>there is a line including site configurations from:</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">include</span> <span class="n">/etc/nginx/sites-enabled/*</span>;
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-QXJjaCBMaW51eA== docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>less /etc/nginx/nginx.conf
</pre></div>
</div>
<p>in there is a configuration section named <code class="docutils literal notranslate"><span class="pre">server</span></code>:</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">server</span> <span class="p">{</span>
<span class="kn">listen</span> <span class="mi">80</span><span class="p">;</span>
<span class="kn">server_name</span> <span class="s">localhost</span><span class="p">;</span>
<span class="c1"># ...</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-RmVkb3JhIC8gUkhFTA== docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>less /etc/nginx/nginx.conf
</pre></div>
</div>
<p>there is a line including site configurations from:</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">include</span> <span class="n">/etc/nginx/conf.d/*.conf</span>;
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="a-nginx-searx-site">
<span id="nginx-searx-site"></span><h2><a class="toc-backref" href="#id2">A nginx searx site</a><a class="headerlink" href="#a-nginx-searx-site" title="Permalink to this headline"></a></h2>
<div class="sidebar">
<p class="sidebar-title">public to the internet?</p>
<p>If your searx instance is public, stop here and first install <a class="reference internal" href="../utils/filtron.sh.html#filtron-sh"><span class="std std-ref">filtron
reverse proxy</span></a> and <a class="reference internal" href="../utils/morty.sh.html#morty-sh"><span class="std std-ref">result proxy morty</span></a>, see
<a class="reference internal" href="installation.html#installation-scripts"><span class="std std-ref">Installation scripts</span></a>. If already done, follow setup: <em>searx via
filtron plus morty</em>.</p>
</div>
<p>Now you have to create a configuration for the searx site. If <a class="reference external" href="https://docs.nginx.com/nginx/admin-guide/">nginx</a> is new to
you, the <a class="reference external" href="https://nginx.org/en/docs/beginners_guide.html">nginx beginners guide</a> is a good starting point and the <a class="reference external" href="https://www.nginx.com/resources/wiki/start/">Getting
Started wiki</a> is always a good resource <em>to keep in the pocket</em>.</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-VWJ1bnR1IC8gZGViaWFu docutils container">
<div class="docutils container">
<p>Ubuntu / debian</p>
</div>
</div>
<div class="item sphinx-data-tab-QXJjaCBMaW51eA== docutils container">
<div class="docutils container">
<p>Arch Linux</p>
</div>
</div>
<div class="item sphinx-data-tab-RmVkb3JhIC8gUkhFTA== docutils container">
<div class="docutils container">
<p>Fedora / RHEL</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-VWJ1bnR1IC8gZGViaWFu active docutils container">
<p>Create configuration at <code class="docutils literal notranslate"><span class="pre">/etc/nginx/sites-available/searx</span></code> and place a
symlink to sites-enabled:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H ln -s /etc/nginx/sites-available/searx /etc/nginx/sites-enabled/searx
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-QXJjaCBMaW51eA== docutils container">
<p>In the <code class="docutils literal notranslate"><span class="pre">/etc/nginx/nginx.conf</span></code> file, replace the configuration section
named <code class="docutils literal notranslate"><span class="pre">server</span></code>.</p>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-RmVkb3JhIC8gUkhFTA== docutils container">
<p>Create configuration at <code class="docutils literal notranslate"><span class="pre">/etc/nginx/conf.d/searx</span></code> and place a
symlink to sites-enabled:</p>
</div>
</div>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-c2VhcnggdmlhIGZpbHRyb24gcGx1cyBtb3J0eQ== docutils container">
<div class="docutils container">
<p>searx via filtron plus morty</p>
</div>
</div>
<div class="item sphinx-data-tab-cHJveHkgb3IgdVdTR0k= docutils container">
<div class="docutils container">
<p>proxy or uWSGI</p>
</div>
</div>
<div class="item sphinx-data-tab-XC5cLiBhdCBzdWJkaXIgVVJM docutils container">
<div class="docutils container">
<p>.. at subdir URL</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-c2VhcnggdmlhIGZpbHRyb24gcGx1cyBtb3J0eQ== active docutils container">
<p>Use this setup, if your instance is public to the internet, compare
figure: <a class="reference internal" href="architecture.html#arch-public"><span class="std std-ref">architecture</span></a> and <a class="reference internal" href="installation.html#installation-scripts"><span class="std std-ref">Installation scripts</span></a>.</p>
<ol class="arabic simple">
<li><p>Configure a reverse proxy for <a class="reference internal" href="../utils/filtron.sh.html#filtron-sh"><span class="std std-ref">filtron</span></a>, listening on
<em>localhost 4004</em> (<a class="reference internal" href="filtron.html#filtron-route-request"><span class="std std-ref">Route request through filtron</span></a>):</p></li>
</ol>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="c1"># https://example.org/searx</span>
<span class="k">location</span> <span class="s">/searx</span> <span class="p">{</span>
<span class="kn">proxy_pass</span> <span class="s">http://127.0.0.1:4004/</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">Host</span> <span class="nv">$http_host</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">Connection</span> <span class="nv">$http_connection</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Real-IP</span> <span class="nv">$remote_addr</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Forwarded-For</span> <span class="nv">$proxy_add_x_forwarded_for</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Scheme</span> <span class="nv">$scheme</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Script-Name</span> <span class="s">/searx</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">location</span> <span class="s">/searx/static</span> <span class="p">{</span>
<span class="kn">alias</span> <span class="s">/usr/local/searx/searx-src/searx/static</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
<ol class="arabic simple" start="2">
<li><p>Configure reverse proxy for <a class="reference internal" href="morty.html#searx-morty"><span class="std std-ref">morty</span></a>, listening on
<em>localhost 3000</em>:</p></li>
</ol>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="c1"># https://example.org/morty</span>
<span class="k">location</span> <span class="s">/morty</span> <span class="p">{</span>
<span class="kn">proxy_pass</span> <span class="s">http://127.0.0.1:3000/</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">Host</span> <span class="nv">$http_host</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">Connection</span> <span class="nv">$http_connection</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Real-IP</span> <span class="nv">$remote_addr</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Forwarded-For</span> <span class="nv">$proxy_add_x_forwarded_for</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Scheme</span> <span class="nv">$scheme</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Note that reverse proxy advised to be used in case of single-user or
low-traffic instances. For a fully result proxification add <a class="reference internal" href="morty.html#searx-morty"><span class="std std-ref">mortys</span></a> <strong>public URL</strong> to your <a class="reference external" href="https://github.com/searx/searx/blob/master/searx/settings.yml">git://searx/settings.yml</a>:</p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">result_proxy</span><span class="p p-Indicator">:</span>
<span class="c1"># replace example.org with your server&#39;s public name</span>
<span class="l l-Scalar l-Scalar-Plain">url</span> <span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">https://example.org/morty</span>
<span class="l l-Scalar l-Scalar-Plain">server</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">image_proxy</span> <span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">True</span>
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-cHJveHkgb3IgdVdTR0k= docutils container">
<p>Be warned, with this setup, your instance isnt <a class="reference internal" href="filtron.html#searx-filtron"><span class="std std-ref">protected</span></a>. Nevertheless it is good enough for intranet usage and it is a
excellent example of; <em>how different services can be set up</em>. The next
example shows a reverse proxy configuration wrapping the <a class="reference internal" href="installation-uwsgi.html#uwsgi-configuration"><span class="std std-ref">searx-uWSGI
application</span></a>, listening on <code class="docutils literal notranslate"><span class="pre">http</span> <span class="pre">=</span>
<span class="pre">127.0.0.1:8888</span></code>.</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="c1"># https://hostname.local/</span>
<span class="k">location</span> <span class="s">/</span> <span class="p">{</span>
<span class="kn">proxy_pass</span> <span class="s">http://127.0.0.1:8888</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">Host</span> <span class="nv">$host</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">Connection</span> <span class="nv">$http_connection</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Forwarded-For</span> <span class="nv">$proxy_add_x_forwarded_for</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Scheme</span> <span class="nv">$scheme</span><span class="p">;</span>
<span class="kn">proxy_buffering</span> <span class="no">off</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Alternatively you can use the <a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html">uWSGI support from nginx</a> via unix
sockets. For socket communication, you have to activate <code class="docutils literal notranslate"><span class="pre">socket</span> <span class="pre">=</span>
<span class="pre">/run/uwsgi/app/searx/socket</span></code> and comment out the <code class="docutils literal notranslate"><span class="pre">http</span> <span class="pre">=</span>
<span class="pre">127.0.0.1:8888</span></code> configuration in your <a class="reference internal" href="installation-uwsgi.html#uwsgi-configuration"><span class="std std-ref">uwsgi ini file</span></a>.</p>
<p>The example shows a nginx virtual <code class="docutils literal notranslate"><span class="pre">server</span></code> configuration, listening on
port 80 (IPv4 and IPv6 <a class="reference external" href="http://[::]:80">http://[::]:80</a>). The uWSGI app is configured at
location <code class="docutils literal notranslate"><span class="pre">/</span></code> by importing the <a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html#configuring-nginx">uwsgi_params</a> and passing requests to
the uWSGI socket (<code class="docutils literal notranslate"><span class="pre">uwsgi_pass</span></code>). The <code class="docutils literal notranslate"><span class="pre">server</span></code>'s root points to the
<a class="reference internal" href="installation-searx.html#searx-src"><span class="std std-ref">searx-src clone</span></a> and wraps directly the
<a class="reference external" href="https://github.com/searx/searx/blob/master/searx/static/">git://searx/static/</a> content at <code class="docutils literal notranslate"><span class="pre">location</span> <span class="pre">/static</span></code>.</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">server</span> <span class="p">{</span>
<span class="c1"># replace hostname.local with your server&#39;s name</span>
<span class="kn">server_name</span> <span class="s">hostname.local</span><span class="p">;</span>
<span class="kn">listen</span> <span class="mi">80</span><span class="p">;</span>
<span class="kn">listen</span> <span class="s">[::]:80</span><span class="p">;</span>
<span class="kn">location</span> <span class="s">/</span> <span class="p">{</span>
<span class="kn">include</span> <span class="s">uwsgi_params</span><span class="p">;</span>
<span class="kn">uwsgi_pass</span> <span class="s">unix:/run/uwsgi/app/searx/socket</span><span class="p">;</span>
<span class="p">}</span>
<span class="kn">root</span> <span class="s">/usr/local/searx/searx-src/searx</span><span class="p">;</span>
<span class="kn">location</span> <span class="s">/static</span> <span class="p">{</span> <span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p>If not already exists, create a folder for the unix sockets, which can be
used by the searx account:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>mkdir -p /run/uwsgi/app/searx/
sudo -H chown -R searx:searx /run/uwsgi/app/searx/
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-XC5cLiBhdCBzdWJkaXIgVVJM docutils container">
<p>Be warned, with these setups, your instance isnt <a class="reference internal" href="filtron.html#searx-filtron"><span class="std std-ref">protected</span></a>. The examples are just here to demonstrate how to export the
searx application from a subdirectory URL <code class="docutils literal notranslate"><span class="pre">https://example.org/searx/</span></code>.</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="c1"># https://hostname.local/searx</span>
<span class="k">location</span> <span class="s">/searx</span> <span class="p">{</span>
<span class="kn">proxy_pass</span> <span class="s">http://127.0.0.1:8888</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">Host</span> <span class="nv">$host</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">Connection</span> <span class="nv">$http_connection</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Forwarded-For</span> <span class="nv">$proxy_add_x_forwarded_for</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Scheme</span> <span class="nv">$scheme</span><span class="p">;</span>
<span class="kn">proxy_set_header</span> <span class="s">X-Script-Name</span> <span class="s">/searx</span><span class="p">;</span>
<span class="kn">proxy_buffering</span> <span class="no">off</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">location</span> <span class="s">/searx/static</span> <span class="p">{</span>
<span class="kn">alias</span> <span class="s">/usr/local/searx/searx-src/searx/static</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">X-Script-Name</span> <span class="pre">/searx</span></code> is needed by the searx implementation to
calculate relative URLs correct. The next example shows a uWSGI
configuration. Since there are no HTTP headers in a (u)WSGI protocol, the
value is shipped via the <a class="reference external" href="https://werkzeug.palletsprojects.com/en/1.0.x/wsgi/#werkzeug.wsgi.get_script_name">SCRIPT_NAME</a> in the WSGI environment.</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="c1"># https://hostname.local/searx</span>
<span class="k">location</span> <span class="s">/searx</span> <span class="p">{</span>
<span class="kn">uwsgi_param</span> <span class="s">SCRIPT_NAME</span> <span class="s">/searx</span><span class="p">;</span>
<span class="kn">include</span> <span class="s">uwsgi_params</span><span class="p">;</span>
<span class="kn">uwsgi_pass</span> <span class="s">unix:/run/uwsgi/app/searx/socket</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">location</span> <span class="s">/searx/static</span> <span class="p">{</span>
<span class="kn">alias</span> <span class="s">/usr/local/searx/searx-src/searx</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
<p>For searx to work correctly the <code class="docutils literal notranslate"><span class="pre">base_url</span></code> must be set in the
<a class="reference external" href="https://github.com/searx/searx/blob/master/searx/settings.yml">git://searx/settings.yml</a>.</p>
<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">server</span><span class="p p-Indicator">:</span>
<span class="c1"># replace example.org with your server&#39;s public name</span>
<span class="l l-Scalar l-Scalar-Plain">base_url</span> <span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">https://example.org/searx/</span>
</pre></div>
</div>
</div>
</div>
<p>Restart service:</p>
<div class="sphinx-tabs docutils container">
<div class="ui top attached tabular menu sphinx-menu docutils container">
<div class="active item sphinx-data-tab-VWJ1bnR1IC8gZGViaWFu docutils container">
<div class="docutils container">
<p>Ubuntu / debian</p>
</div>
</div>
<div class="item sphinx-data-tab-QXJjaCBMaW51eA== docutils container">
<div class="docutils container">
<p>Arch Linux</p>
</div>
</div>
<div class="item sphinx-data-tab-RmVkb3Jh docutils container">
<div class="docutils container">
<p>Fedora</p>
</div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-VWJ1bnR1IC8gZGViaWFu active docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H systemctl restart nginx
sudo -H service uwsgi restart searx
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-QXJjaCBMaW51eA== docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H systemctl restart nginx
sudo -H systemctl restart uwsgi@searx
</pre></div>
</div>
</div>
<div class="ui bottom attached sphinx-tab tab segment sphinx-data-tab-RmVkb3Jh docutils container">
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H systemctl restart nginx
sudo -H touch /etc/uwsgi.d/searx.ini
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="disable-logs">
<h2><a class="toc-backref" href="#id3">Disable logs</a><a class="headerlink" href="#disable-logs" title="Permalink to this headline"></a></h2>
<p>For better privacy you can disable nginx logs in <code class="docutils literal notranslate"><span class="pre">/etc/nginx/nginx.conf</span></code>.</p>
<div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">http</span> <span class="p">{</span>
<span class="c1"># ...</span>
<span class="kn">access_log</span> <span class="s">/dev/null</span><span class="p">;</span>
<span class="kn">error_log</span> <span class="s">/dev/null</span><span class="p">;</span>
<span class="c1"># ...</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<span id="sidebar-top"></span>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/searx_logo_small.png" alt="Logo"/>
</a></p>
<h3>Project Links</h3>
<ul>
<li><a href="https://github.com/searx/searx">Source</a>
<li><a href="https://github.com/searx/searx/wiki">Wiki</a>
<li><a href="https://searx.space/">Public instances</a>
<li><a href="https://twitter.com/Searx_engine">Twitter</a>
</ul><h3>Navigation</h3>
<ul>
<li><a href="../index.html">Overview</a>
<ul>
<li><a href="index.html">Administrator documentation</a>
<ul>
<li>Previous: <a href="installation-uwsgi.html" title="previous chapter">uwsgi</a>
<li>Next: <a href="installation-apache.html" title="next chapter">Install with apache</a></ul>
</li>
</ul>
</li>
</ul>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2015-2020, Adam Tauber, Noémi Ványi.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
</div>
<script src="../_static/version_warning_offset.js"></script>
</body>
</html>