searx/admin/installation-nginx.html

394 lines
32 KiB
HTML
Raw Normal View History

2020-06-19 11:15:15 +02:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
2020-09-30 10:35:05 +02:00
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2020-06-19 11:15:15 +02:00
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Install with nginx &#8212; Searx Documentation (Searx-1.0.0.tex)</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/searx.css" />
<link rel="stylesheet" type="text/css" href="../_static/tabs.css" />
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
2020-06-19 11:15:15 +02:00
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/tabs.js"></script>
2020-06-19 11:15:15 +02:00
<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" />
2020-06-19 11:15:15 +02:00
</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>
2020-06-19 11:15:15 +02:00
<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-1.0.0.tex)</a> &#187;</li>
2020-09-30 10:35:05 +02:00
<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>
2020-06-19 11:15:15 +02:00
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="install-with-nginx">
2020-06-19 11:15:15 +02:00
<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">
2020-06-19 11:15:15 +02:00
<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>
2020-06-19 11:15:15 +02:00
<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>
2020-06-19 11:15:15 +02:00
<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">
2020-06-19 11:15:15 +02:00
<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 aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-0-VWJ1bnR1IC8gZGViaWFu" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-0-VWJ1bnR1IC8gZGViaWFu" name="VWJ1bnR1IC8gZGViaWFu" role="tab" tabindex="0">Ubuntu / debian</button><button aria-controls="panel-0-QXJjaCBMaW51eA==" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-0-QXJjaCBMaW51eA==" name="QXJjaCBMaW51eA==" role="tab" tabindex="-1">Arch Linux</button><button aria-controls="panel-0-RmVkb3JhIC8gUkhFTA==" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-0-RmVkb3JhIC8gUkhFTA==" name="RmVkb3JhIC8gUkhFTA==" role="tab" tabindex="-1">Fedora / RHEL</button></div><div aria-labelledby="tab-0-VWJ1bnR1IC8gZGViaWFu" class="sphinx-tabs-panel group-tab" id="panel-0-VWJ1bnR1IC8gZGViaWFu" name="VWJ1bnR1IC8gZGViaWFu" role="tabpanel" tabindex="0"><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H apt-get install nginx
2020-06-19 11:15:15 +02:00
</pre></div>
</div>
</div><div aria-labelledby="tab-0-QXJjaCBMaW51eA==" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-0-QXJjaCBMaW51eA==" name="QXJjaCBMaW51eA==" role="tabpanel" tabindex="0"><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H pacman -S nginx-mainline
2020-06-19 11:15:15 +02:00
sudo -H systemctl <span class="nb">enable</span> nginx
sudo -H systemctl start nginx
</pre></div>
</div>
</div><div aria-labelledby="tab-0-RmVkb3JhIC8gUkhFTA==" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-0-RmVkb3JhIC8gUkhFTA==" name="RmVkb3JhIC8gUkhFTA==" role="tabpanel" tabindex="0"><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H dnf install nginx
2020-06-19 11:15:15 +02:00
sudo -H systemctl <span class="nb">enable</span> nginx
sudo -H systemctl start nginx
</pre></div>
</div>
</div></div>
2020-06-19 11:15:15 +02:00
<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 aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-1-VWJ1bnR1IC8gZGViaWFu" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-1-VWJ1bnR1IC8gZGViaWFu" name="VWJ1bnR1IC8gZGViaWFu" role="tab" tabindex="0">Ubuntu / debian</button><button aria-controls="panel-1-QXJjaCBMaW51eA==" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-1-QXJjaCBMaW51eA==" name="QXJjaCBMaW51eA==" role="tab" tabindex="-1">Arch Linux</button><button aria-controls="panel-1-RmVkb3JhIC8gUkhFTA==" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-1-RmVkb3JhIC8gUkhFTA==" name="RmVkb3JhIC8gUkhFTA==" role="tab" tabindex="-1">Fedora / RHEL</button></div><div aria-labelledby="tab-1-VWJ1bnR1IC8gZGViaWFu" class="sphinx-tabs-panel group-tab" id="panel-1-VWJ1bnR1IC8gZGViaWFu" name="VWJ1bnR1IC8gZGViaWFu" role="tabpanel" tabindex="0"><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>less /etc/nginx/nginx.conf
2020-06-19 11:15:15 +02:00
</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 aria-labelledby="tab-1-QXJjaCBMaW51eA==" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-1-QXJjaCBMaW51eA==" name="QXJjaCBMaW51eA==" role="tabpanel" tabindex="0"><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>less /etc/nginx/nginx.conf
2020-06-19 11:15:15 +02:00
</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 aria-labelledby="tab-1-RmVkb3JhIC8gUkhFTA==" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-1-RmVkb3JhIC8gUkhFTA==" name="RmVkb3JhIC8gUkhFTA==" role="tabpanel" tabindex="0"><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>less /etc/nginx/nginx.conf
2020-06-19 11:15:15 +02:00
</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">
2020-06-19 11:15:15 +02:00
<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">
2020-06-19 11:15:15 +02:00
<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>
2020-06-19 11:15:15 +02:00
<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
2020-06-19 11:15:15 +02:00
Started wiki</a> is always a good resource <em>to keep in the pocket</em>.</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-2-VWJ1bnR1IC8gZGViaWFu" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-2-VWJ1bnR1IC8gZGViaWFu" name="VWJ1bnR1IC8gZGViaWFu" role="tab" tabindex="0">Ubuntu / debian</button><button aria-controls="panel-2-QXJjaCBMaW51eA==" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-2-QXJjaCBMaW51eA==" name="QXJjaCBMaW51eA==" role="tab" tabindex="-1">Arch Linux</button><button aria-controls="panel-2-RmVkb3JhIC8gUkhFTA==" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-2-RmVkb3JhIC8gUkhFTA==" name="RmVkb3JhIC8gUkhFTA==" role="tab" tabindex="-1">Fedora / RHEL</button></div><div aria-labelledby="tab-2-VWJ1bnR1IC8gZGViaWFu" class="sphinx-tabs-panel group-tab" id="panel-2-VWJ1bnR1IC8gZGViaWFu" name="VWJ1bnR1IC8gZGViaWFu" role="tabpanel" tabindex="0"><p>Create configuration at <code class="docutils literal notranslate"><span class="pre">/etc/nginx/sites-available/searx</span></code> and place a
2020-06-19 11:15:15 +02:00
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 aria-labelledby="tab-2-QXJjaCBMaW51eA==" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-2-QXJjaCBMaW51eA==" name="QXJjaCBMaW51eA==" role="tabpanel" tabindex="0"><p>In the <code class="docutils literal notranslate"><span class="pre">/etc/nginx/nginx.conf</span></code> file, replace the configuration section
2020-06-19 11:15:15 +02:00
named <code class="docutils literal notranslate"><span class="pre">server</span></code>.</p>
</div><div aria-labelledby="tab-2-RmVkb3JhIC8gUkhFTA==" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-2-RmVkb3JhIC8gUkhFTA==" name="RmVkb3JhIC8gUkhFTA==" role="tabpanel" tabindex="0"><p>Create configuration at <code class="docutils literal notranslate"><span class="pre">/etc/nginx/conf.d/searx</span></code> and place a
2020-06-19 11:15:15 +02:00
symlink to sites-enabled:</p>
</div></div>
<div class="sphinx-tabs docutils container" id="nginx-searx-via-filtron-plus-morty">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-3-c2VhcnggdmlhIGZpbHRyb24gcGx1cyBtb3J0eQ==" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-3-c2VhcnggdmlhIGZpbHRyb24gcGx1cyBtb3J0eQ==" name="c2VhcnggdmlhIGZpbHRyb24gcGx1cyBtb3J0eQ==" role="tab" tabindex="0">searx via filtron plus morty</button><button aria-controls="panel-3-cHJveHkgb3IgdVdTR0k=" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-3-cHJveHkgb3IgdVdTR0k=" name="cHJveHkgb3IgdVdTR0k=" role="tab" tabindex="-1">proxy or uWSGI</button><button aria-controls="panel-3-XC5cLiBhdCBzdWJkaXIgVVJM" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-3-XC5cLiBhdCBzdWJkaXIgVVJM" name="XC5cLiBhdCBzdWJkaXIgVVJM" role="tab" tabindex="-1">.. at subdir URL</button></div><div aria-labelledby="tab-3-c2VhcnggdmlhIGZpbHRyb24gcGx1cyBtb3J0eQ==" class="sphinx-tabs-panel group-tab" id="panel-3-c2VhcnggdmlhIGZpbHRyb24gcGx1cyBtb3J0eQ==" name="c2VhcnggdmlhIGZpbHRyb24gcGx1cyBtb3J0eQ==" role="tabpanel" tabindex="0"><p>Use this setup, if your instance is public to the internet, compare
2020-06-19 11:15:15 +02:00
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">$host</span><span class="p">;</span>
2020-06-19 11:15:15 +02:00
<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>
2020-06-19 11:15:15 +02:00
<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">$host</span><span class="p">;</span>
2020-06-19 11:15:15 +02:00
<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>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="nt">result_proxy</span><span class="p">:</span>
2020-06-19 11:15:15 +02:00
<span class="c1"># replace example.org with your server&#39;s public name</span>
<span class="nt">url </span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">https://example.org/morty</span>
<span class="nt">key </span><span class="p">:</span> <span class="kt">!!binary</span> <span class="s">&quot;insert_your_morty_proxy_key_here&quot;</span>
2020-06-19 11:15:15 +02:00
<span class="nt">server</span><span class="p">:</span>
<span class="nt">image_proxy </span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">True</span>
2020-06-19 11:15:15 +02:00
</pre></div>
</div>
</div><div aria-labelledby="tab-3-cHJveHkgb3IgdVdTR0k=" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-3-cHJveHkgb3IgdVdTR0k=" name="cHJveHkgb3IgdVdTR0k=" role="tabpanel" tabindex="0"><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
2020-06-19 11:15:15 +02:00
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
2020-09-30 10:35:05 +02:00
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
2020-06-19 11:15:15 +02:00
<a class="reference internal" href="installation-searx.html#searx-src"><span class="std std-ref">searx-src clone</span></a> and wraps directly the
2020-09-30 10:35:05 +02:00
<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>
2020-06-19 11:15:15 +02:00
<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 aria-labelledby="tab-3-XC5cLiBhdCBzdWJkaXIgVVJM" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-3-XC5cLiBhdCBzdWJkaXIgVVJM" name="XC5cLiBhdCBzdWJkaXIgVVJM" role="tabpanel" tabindex="0"><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
2020-06-19 11:15:15 +02:00
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>
2020-06-19 11:15:15 +02:00
<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>
2020-06-19 11:15:15 +02:00
<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
2020-09-30 10:35:05 +02:00
<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="nt">server</span><span class="p">:</span>
2020-06-19 11:15:15 +02:00
<span class="c1"># replace example.org with your server&#39;s public name</span>
<span class="nt">base_url </span><span class="p">:</span> <span class="l l-Scalar l-Scalar-Plain">https://example.org/searx/</span>
2020-06-19 11:15:15 +02:00
</pre></div>
</div>
</div></div>
2020-06-19 11:15:15 +02:00
<p>Restart service:</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-4-VWJ1bnR1IC8gZGViaWFu" aria-selected="true" class="sphinx-tabs-tab group-tab" id="tab-4-VWJ1bnR1IC8gZGViaWFu" name="VWJ1bnR1IC8gZGViaWFu" role="tab" tabindex="0">Ubuntu / debian</button><button aria-controls="panel-4-QXJjaCBMaW51eA==" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-4-QXJjaCBMaW51eA==" name="QXJjaCBMaW51eA==" role="tab" tabindex="-1">Arch Linux</button><button aria-controls="panel-4-RmVkb3Jh" aria-selected="false" class="sphinx-tabs-tab group-tab" id="tab-4-RmVkb3Jh" name="RmVkb3Jh" role="tab" tabindex="-1">Fedora</button></div><div aria-labelledby="tab-4-VWJ1bnR1IC8gZGViaWFu" class="sphinx-tabs-panel group-tab" id="panel-4-VWJ1bnR1IC8gZGViaWFu" name="VWJ1bnR1IC8gZGViaWFu" role="tabpanel" tabindex="0"><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H systemctl restart nginx
2020-06-19 11:15:15 +02:00
sudo -H service uwsgi restart searx
</pre></div>
</div>
</div><div aria-labelledby="tab-4-QXJjaCBMaW51eA==" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-4-QXJjaCBMaW51eA==" name="QXJjaCBMaW51eA==" role="tabpanel" tabindex="0"><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H systemctl restart nginx
2020-06-19 11:15:15 +02:00
sudo -H systemctl restart uwsgi@searx
</pre></div>
</div>
</div><div aria-labelledby="tab-4-RmVkb3Jh" class="sphinx-tabs-panel group-tab" hidden="true" id="panel-4-RmVkb3Jh" name="RmVkb3Jh" role="tabpanel" tabindex="0"><div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>sudo -H systemctl restart nginx
2020-06-19 11:15:15 +02:00
sudo -H touch /etc/uwsgi.d/searx.ini
</pre></div>
</div>
</div></div>
</div>
<div class="section" id="disable-logs">
2020-06-19 11:15:15 +02:00
<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>
2020-06-19 11:15:15 +02:00
2020-09-30 10:35:05 +02:00
<div class="clearer"></div>
2020-06-19 11:15:15 +02:00
</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="blog/index.html">Blog</a>
2020-09-30 10:35:05 +02:00
<li><a href="https://github.com/searx/searx">Source</a>
2020-06-19 11:15:15 +02:00
2020-09-30 10:35:05 +02:00
<li><a href="https://github.com/searx/searx/wiki">Wiki</a>
2020-06-19 11:15:15 +02:00
<li><a href="https://searx.space">Public instances</a>
2020-06-19 11:15:15 +02:00
<li><a href="https://twitter.com/Searx_engine">Twitter</a>
<li><a href="https://github.com/searx/searx/issues">Issue Tracker</a>
2020-06-19 11:15:15 +02:00
</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" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
2020-06-19 11:15:15 +02:00
<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-2021, Adam Tauber, Noémi Ványi.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.4.0.
2020-06-19 11:15:15 +02:00
</div>
<script src="../_static/version_warning_offset.js"></script>
</body>
</html>