installation-nginx.html 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>Install with nginx &#8212; Searx Documentation (Searx-1.1.0.tex)</title>
  8. <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
  9. <link rel="stylesheet" type="text/css" href="../_static/searx.css" />
  10. <link rel="stylesheet" type="text/css" href="../_static/tabs.css" />
  11. <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
  12. <script src="../_static/jquery.js"></script>
  13. <script src="../_static/underscore.js"></script>
  14. <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
  15. <script src="../_static/doctools.js"></script>
  16. <script src="../_static/sphinx_highlight.js"></script>
  17. <script src="../_static/tabs.js"></script>
  18. <link rel="index" title="Index" href="../genindex.html" />
  19. <link rel="search" title="Search" href="../search.html" />
  20. <link rel="next" title="Install with apache" href="installation-apache.html" />
  21. <link rel="prev" title="uwsgi" href="installation-uwsgi.html" />
  22. </head><body>
  23. <div class="related" role="navigation" aria-label="related navigation">
  24. <h3>Navigation</h3>
  25. <ul>
  26. <li class="right" style="margin-right: 10px">
  27. <a href="../genindex.html" title="General Index"
  28. accesskey="I">index</a></li>
  29. <li class="right" >
  30. <a href="../py-modindex.html" title="Python Module Index"
  31. >modules</a> |</li>
  32. <li class="right" >
  33. <a href="installation-apache.html" title="Install with apache"
  34. accesskey="N">next</a> |</li>
  35. <li class="right" >
  36. <a href="installation-uwsgi.html" title="uwsgi"
  37. accesskey="P">previous</a> |</li>
  38. <li class="nav-item nav-item-0"><a href="../index.html">Searx Documentation (Searx-1.1.0.tex)</a> &#187;</li>
  39. <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Administrator documentation</a> &#187;</li>
  40. <li class="nav-item nav-item-this"><a href="">Install with nginx</a></li>
  41. </ul>
  42. </div>
  43. <div class="document">
  44. <div class="documentwrapper">
  45. <div class="bodywrapper">
  46. <div class="body" role="main">
  47. <section id="install-with-nginx">
  48. <span id="installation-nginx"></span><h1>Install with nginx<a class="headerlink" href="#install-with-nginx" title="Permalink to this heading">¶</a></h1>
  49. <aside class="sidebar">
  50. <p class="sidebar-title">further reading</p>
  51. <ul class="simple">
  52. <li><p><a class="reference external" href="https://docs.nginx.com/nginx/admin-guide/">nginx</a></p></li>
  53. <li><p><a class="reference external" href="https://nginx.org/en/docs/beginners_guide.html">nginx beginners guide</a></p></li>
  54. <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>
  55. <li><p><a class="reference external" href="https://www.nginx.com/resources/wiki/start/">Getting Started wiki</a></p></li>
  56. <li><p><a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html">uWSGI support from nginx</a></p></li>
  57. </ul>
  58. </aside>
  59. <nav class="contents local" id="contents">
  60. <p class="topic-title">Contents</p>
  61. <ul class="simple">
  62. <li><p><a class="reference internal" href="#the-nginx-http-server" id="id1">The nginx HTTP server</a></p></li>
  63. <li><p><a class="reference internal" href="#a-nginx-searx-site" id="id2">A nginx searx site</a></p></li>
  64. <li><p><a class="reference internal" href="#disable-logs" id="id3">Disable logs</a></p></li>
  65. </ul>
  66. </nav>
  67. <hr class="docutils" />
  68. <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>
  69. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/filtron.sh nginx install
  70. </pre></div>
  71. </div>
  72. <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>
  73. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>$ sudo -H ./utils/morty.sh nginx install
  74. </pre></div>
  75. </div>
  76. <hr class="docutils" />
  77. <section id="the-nginx-http-server">
  78. <h2><a class="toc-backref" href="#id1" role="doc-backlink">The nginx HTTP server</a><a class="headerlink" href="#the-nginx-http-server" title="Permalink to this heading">¶</a></h2>
  79. <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),
  80. install it now.</p>
  81. <div class="sphinx-tabs docutils container">
  82. <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
  83. </pre></div>
  84. </div>
  85. </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
  86. sudo -H systemctl <span class="nb">enable</span> nginx
  87. sudo -H systemctl start nginx
  88. </pre></div>
  89. </div>
  90. </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
  91. sudo -H systemctl <span class="nb">enable</span> nginx
  92. sudo -H systemctl start nginx
  93. </pre></div>
  94. </div>
  95. </div></div>
  96. <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
  97. see a <em>Fedora Webserver - Test Page</em>. The test page comes from the default
  98. <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,
  99. depends on the linux distribution:</p>
  100. <div class="sphinx-tabs docutils container">
  101. <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
  102. </pre></div>
  103. </div>
  104. <p>there is a line including site configurations from:</p>
  105. <div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">include</span><span class="w"> </span><span class="n">/etc/nginx/sites-enabled/*</span>;<span class="w"></span>
  106. </pre></div>
  107. </div>
  108. </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
  109. </pre></div>
  110. </div>
  111. <p>in there is a configuration section named <code class="docutils literal notranslate"><span class="pre">server</span></code>:</p>
  112. <div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">server</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  113. <span class="w"> </span><span class="kn">listen</span><span class="w"> </span><span class="mi">80</span><span class="p">;</span><span class="w"></span>
  114. <span class="w"> </span><span class="kn">server_name</span><span class="w"> </span><span class="s">localhost</span><span class="p">;</span><span class="w"></span>
  115. <span class="w"> </span><span class="c1"># ...</span>
  116. <span class="p">}</span><span class="w"></span>
  117. </pre></div>
  118. </div>
  119. </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
  120. </pre></div>
  121. </div>
  122. <p>there is a line including site configurations from:</p>
  123. <div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">include</span><span class="w"> </span><span class="n">/etc/nginx/conf.d/*.conf</span>;<span class="w"></span>
  124. </pre></div>
  125. </div>
  126. </div></div>
  127. </section>
  128. <section id="a-nginx-searx-site">
  129. <span id="nginx-searx-site"></span><h2><a class="toc-backref" href="#id2" role="doc-backlink">A nginx searx site</a><a class="headerlink" href="#a-nginx-searx-site" title="Permalink to this heading">¶</a></h2>
  130. <aside class="sidebar">
  131. <p class="sidebar-title">public to the internet?</p>
  132. <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
  133. 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
  134. <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
  135. filtron plus morty</em>.</p>
  136. </aside>
  137. <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
  138. 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
  139. Started wiki</a> is always a good resource <em>to keep in the pocket</em>.</p>
  140. <div class="sphinx-tabs docutils container">
  141. <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
  142. symlink to sites-enabled:</p>
  143. <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
  144. </pre></div>
  145. </div>
  146. </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
  147. named <code class="docutils literal notranslate"><span class="pre">server</span></code>.</p>
  148. </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
  149. symlink to sites-enabled:</p>
  150. </div></div>
  151. <div class="sphinx-tabs docutils container" id="nginx-searx-via-filtron-plus-morty">
  152. <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
  153. 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>
  154. <ol class="arabic simple">
  155. <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
  156. <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>
  157. </ol>
  158. <div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="c1"># https://example.org/searx</span>
  159. <span class="k">location</span><span class="w"> </span><span class="s">/searx</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  160. <span class="w"> </span><span class="kn">proxy_pass</span><span class="w"> </span><span class="s">http://127.0.0.1:4004/</span><span class="p">;</span><span class="w"></span>
  161. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">Host</span><span class="w"> </span><span class="nv">$host</span><span class="p">;</span><span class="w"></span>
  162. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">Connection</span><span class="w"> </span><span class="nv">$http_connection</span><span class="p">;</span><span class="w"></span>
  163. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Real-IP</span><span class="w"> </span><span class="nv">$remote_addr</span><span class="p">;</span><span class="w"></span>
  164. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Forwarded-For</span><span class="w"> </span><span class="nv">$proxy_add_x_forwarded_for</span><span class="p">;</span><span class="w"></span>
  165. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Scheme</span><span class="w"> </span><span class="nv">$scheme</span><span class="p">;</span><span class="w"></span>
  166. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Script-Name</span><span class="w"> </span><span class="s">/searx</span><span class="p">;</span><span class="w"></span>
  167. <span class="p">}</span><span class="w"></span>
  168. <span class="k">location</span><span class="w"> </span><span class="s">/searx/static/</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  169. <span class="w"> </span><span class="kn">alias</span><span class="w"> </span><span class="s">/usr/local/searx/searx-src/searx/static/</span><span class="p">;</span><span class="w"></span>
  170. <span class="p">}</span><span class="w"></span>
  171. </pre></div>
  172. </div>
  173. <ol class="arabic simple" start="2">
  174. <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
  175. <em>localhost 3000</em>:</p></li>
  176. </ol>
  177. <div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="c1"># https://example.org/morty</span>
  178. <span class="k">location</span><span class="w"> </span><span class="s">/morty</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  179. <span class="w"> </span><span class="kn">proxy_pass</span><span class="w"> </span><span class="s">http://127.0.0.1:3000/</span><span class="p">;</span><span class="w"></span>
  180. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">Host</span><span class="w"> </span><span class="nv">$host</span><span class="p">;</span><span class="w"></span>
  181. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">Connection</span><span class="w"> </span><span class="nv">$http_connection</span><span class="p">;</span><span class="w"></span>
  182. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Real-IP</span><span class="w"> </span><span class="nv">$remote_addr</span><span class="p">;</span><span class="w"></span>
  183. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Forwarded-For</span><span class="w"> </span><span class="nv">$proxy_add_x_forwarded_for</span><span class="p">;</span><span class="w"></span>
  184. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Scheme</span><span class="w"> </span><span class="nv">$scheme</span><span class="p">;</span><span class="w"></span>
  185. <span class="p">}</span><span class="w"></span>
  186. </pre></div>
  187. </div>
  188. <p>For a fully result proxification add <a class="reference internal" href="morty.html#searx-morty"><span class="std std-ref">morty’s</span></a> <strong>public
  189. URL</strong> to your <a class="reference external" href="https://github.com/searx/searx/blob/master/searx/settings.yml">Origin: searx/settings.yml</a>:</p>
  190. <div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nt">result_proxy</span><span class="p">:</span><span class="w"></span>
  191. <span class="w"> </span><span class="c1"># replace example.org with your server&#39;s public name</span><span class="w"></span>
  192. <span class="w"> </span><span class="nt">url </span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">https://example.org/morty</span><span class="w"></span>
  193. <span class="w"> </span><span class="nt">key </span><span class="p">:</span><span class="w"> </span><span class="kt">!!binary</span><span class="w"> </span><span class="s">&quot;insert_your_morty_proxy_key_here&quot;</span><span class="w"></span>
  194. <span class="nt">server</span><span class="p">:</span><span class="w"></span>
  195. <span class="w"> </span><span class="nt">image_proxy </span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">True</span><span class="w"></span>
  196. </pre></div>
  197. </div>
  198. </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 isn’t <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
  199. excellent example of; <em>how different services can be set up</em>. The next
  200. 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
  201. application</span></a>, listening on <code class="docutils literal notranslate"><span class="pre">http</span> <span class="pre">=</span>
  202. <span class="pre">127.0.0.1:8888</span></code>.</p>
  203. <div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="c1"># https://hostname.local/</span>
  204. <span class="k">location</span><span class="w"> </span><span class="s">/</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  205. <span class="w"> </span><span class="kn">proxy_pass</span><span class="w"> </span><span class="s">http://127.0.0.1:8888</span><span class="p">;</span><span class="w"></span>
  206. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">Host</span><span class="w"> </span><span class="nv">$host</span><span class="p">;</span><span class="w"></span>
  207. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">Connection</span><span class="w"> </span><span class="nv">$http_connection</span><span class="p">;</span><span class="w"></span>
  208. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Forwarded-For</span><span class="w"> </span><span class="nv">$proxy_add_x_forwarded_for</span><span class="p">;</span><span class="w"></span>
  209. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Scheme</span><span class="w"> </span><span class="nv">$scheme</span><span class="p">;</span><span class="w"></span>
  210. <span class="w"> </span><span class="kn">proxy_buffering</span><span class="w"> </span><span class="no">off</span><span class="p">;</span><span class="w"></span>
  211. <span class="p">}</span><span class="w"></span>
  212. </pre></div>
  213. </div>
  214. <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
  215. sockets. For socket communication, you have to activate <code class="docutils literal notranslate"><span class="pre">socket</span> <span class="pre">=</span>
  216. <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>
  217. <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>
  218. <p>The example shows a nginx virtual <code class="docutils literal notranslate"><span class="pre">server</span></code> configuration, listening on
  219. port 80 (IPv4 and IPv6 <a class="reference external" href="http://[::]:80">http://[::]:80</a>). The uWSGI app is configured at
  220. 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
  221. 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
  222. <a class="reference internal" href="installation-searx.html#searx-src"><span class="std std-ref">searx-src clone</span></a> and wraps directly the
  223. <a class="reference external" href="https://github.com/searx/searx/blob/master/searx/static/">Origin: searx/static/</a> content at <code class="docutils literal notranslate"><span class="pre">location</span> <span class="pre">/static</span></code>.</p>
  224. <div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">server</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  225. <span class="w"> </span><span class="c1"># replace hostname.local with your server&#39;s name</span>
  226. <span class="w"> </span><span class="kn">server_name</span><span class="w"> </span><span class="s">hostname.local</span><span class="p">;</span><span class="w"></span>
  227. <span class="w"> </span><span class="kn">listen</span><span class="w"> </span><span class="mi">80</span><span class="p">;</span><span class="w"></span>
  228. <span class="w"> </span><span class="kn">listen</span><span class="w"> </span><span class="s">[::]:80</span><span class="p">;</span><span class="w"></span>
  229. <span class="w"> </span><span class="kn">location</span><span class="w"> </span><span class="s">/</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  230. <span class="w"> </span><span class="kn">include</span><span class="w"> </span><span class="s">uwsgi_params</span><span class="p">;</span><span class="w"></span>
  231. <span class="w"> </span><span class="kn">uwsgi_pass</span><span class="w"> </span><span class="s">unix:/run/uwsgi/app/searx/socket</span><span class="p">;</span><span class="w"></span>
  232. <span class="w"> </span><span class="p">}</span><span class="w"></span>
  233. <span class="w"> </span><span class="kn">root</span><span class="w"> </span><span class="s">/usr/local/searx/searx-src/searx</span><span class="p">;</span><span class="w"></span>
  234. <span class="w"> </span><span class="kn">location</span><span class="w"> </span><span class="s">/static</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
  235. <span class="p">}</span><span class="w"></span>
  236. </pre></div>
  237. </div>
  238. <p>If not already exists, create a folder for the unix sockets, which can be
  239. used by the searx account:</p>
  240. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>mkdir -p /run/uwsgi/app/searx/
  241. sudo -H chown -R searx:searx /run/uwsgi/app/searx/
  242. </pre></div>
  243. </div>
  244. </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 isn’t <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
  245. searx application from a subdirectory URL <code class="docutils literal notranslate"><span class="pre">https://example.org/searx/</span></code>.</p>
  246. <div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="c1"># https://hostname.local/searx</span>
  247. <span class="k">location</span><span class="w"> </span><span class="s">/searx</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  248. <span class="w"> </span><span class="kn">proxy_pass</span><span class="w"> </span><span class="s">http://127.0.0.1:8888</span><span class="p">;</span><span class="w"></span>
  249. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">Host</span><span class="w"> </span><span class="nv">$host</span><span class="p">;</span><span class="w"></span>
  250. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">Connection</span><span class="w"> </span><span class="nv">$http_connection</span><span class="p">;</span><span class="w"></span>
  251. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Forwarded-For</span><span class="w"> </span><span class="nv">$proxy_add_x_forwarded_for</span><span class="p">;</span><span class="w"></span>
  252. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Scheme</span><span class="w"> </span><span class="nv">$scheme</span><span class="p">;</span><span class="w"></span>
  253. <span class="w"> </span><span class="kn">proxy_set_header</span><span class="w"> </span><span class="s">X-Script-Name</span><span class="w"> </span><span class="s">/searx</span><span class="p">;</span><span class="w"></span>
  254. <span class="w"> </span><span class="kn">proxy_buffering</span><span class="w"> </span><span class="no">off</span><span class="p">;</span><span class="w"></span>
  255. <span class="p">}</span><span class="w"></span>
  256. <span class="k">location</span><span class="w"> </span><span class="s">/searx/static/</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  257. <span class="w"> </span><span class="kn">alias</span><span class="w"> </span><span class="s">/usr/local/searx/searx-src/searx/static/</span><span class="p">;</span><span class="w"></span>
  258. <span class="p">}</span><span class="w"></span>
  259. </pre></div>
  260. </div>
  261. <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
  262. calculate relative URLs correct. The next example shows a uWSGI
  263. configuration. Since there are no HTTP headers in a (u)WSGI protocol, the
  264. 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>
  265. <div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="c1"># https://hostname.local/searx</span>
  266. <span class="k">location</span><span class="w"> </span><span class="s">/searx</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  267. <span class="w"> </span><span class="kn">uwsgi_param</span><span class="w"> </span><span class="s">SCRIPT_NAME</span><span class="w"> </span><span class="s">/searx</span><span class="p">;</span><span class="w"></span>
  268. <span class="w"> </span><span class="kn">include</span><span class="w"> </span><span class="s">uwsgi_params</span><span class="p">;</span><span class="w"></span>
  269. <span class="w"> </span><span class="kn">uwsgi_pass</span><span class="w"> </span><span class="s">unix:/run/uwsgi/app/searx/socket</span><span class="p">;</span><span class="w"></span>
  270. <span class="p">}</span><span class="w"></span>
  271. <span class="k">location</span><span class="w"> </span><span class="s">/searx/static/</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  272. <span class="w"> </span><span class="kn">alias</span><span class="w"> </span><span class="s">/usr/local/searx/searx-src/searx/</span><span class="p">;</span><span class="w"></span>
  273. <span class="p">}</span><span class="w"></span>
  274. </pre></div>
  275. </div>
  276. <p>For searx to work correctly the <code class="docutils literal notranslate"><span class="pre">base_url</span></code> must be set in the
  277. <a class="reference external" href="https://github.com/searx/searx/blob/master/searx/settings.yml">Origin: searx/settings.yml</a>.</p>
  278. <div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nt">server</span><span class="p">:</span><span class="w"></span>
  279. <span class="w"> </span><span class="c1"># replace example.org with your server&#39;s public name</span><span class="w"></span>
  280. <span class="w"> </span><span class="nt">base_url </span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">https://example.org/searx/</span><span class="w"></span>
  281. </pre></div>
  282. </div>
  283. </div></div>
  284. <p>Restart service:</p>
  285. <div class="sphinx-tabs docutils container">
  286. <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
  287. sudo -H service uwsgi restart searx
  288. </pre></div>
  289. </div>
  290. </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
  291. sudo -H systemctl restart uwsgi@searx
  292. </pre></div>
  293. </div>
  294. </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
  295. sudo -H touch /etc/uwsgi.d/searx.ini
  296. </pre></div>
  297. </div>
  298. </div></div>
  299. </section>
  300. <section id="disable-logs">
  301. <h2><a class="toc-backref" href="#id3" role="doc-backlink">Disable logs</a><a class="headerlink" href="#disable-logs" title="Permalink to this heading">¶</a></h2>
  302. <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>
  303. <div class="highlight-nginx notranslate"><div class="highlight"><pre><span></span><span class="k">http</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
  304. <span class="w"> </span><span class="c1"># ...</span>
  305. <span class="w"> </span><span class="kn">access_log</span><span class="w"> </span><span class="s">/dev/null</span><span class="p">;</span><span class="w"></span>
  306. <span class="w"> </span><span class="kn">error_log</span><span class="w"> </span><span class="s">/dev/null</span><span class="p">;</span><span class="w"></span>
  307. <span class="w"> </span><span class="c1"># ...</span>
  308. <span class="p">}</span><span class="w"></span>
  309. </pre></div>
  310. </div>
  311. </section>
  312. </section>
  313. <div class="clearer"></div>
  314. </div>
  315. </div>
  316. </div>
  317. <span id="sidebar-top"></span>
  318. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  319. <div class="sphinxsidebarwrapper">
  320. <p class="logo"><a href="../index.html">
  321. <img class="logo" src="../_static/searx_logo_small.png" alt="Logo"/>
  322. </a></p>
  323. <h3>Project Links</h3>
  324. <ul>
  325. <li><a href="https://searx.github.io/searx/blog/index.html">Blog</a>
  326. <li><a href="https://github.com/searx/searx">Source</a>
  327. <li><a href="https://github.com/searx/searx/wiki">Wiki</a>
  328. <li><a href="https://twitter.com/Searx_engine">Twitter</a>
  329. <li><a href="https://github.com/searx/searx/issues">Issue Tracker</a>
  330. </ul><h3>Navigation</h3>
  331. <ul>
  332. <li><a href="../index.html">Overview</a>
  333. <ul>
  334. <li><a href="index.html">Administrator documentation</a>
  335. <ul>
  336. <li>Previous: <a href="installation-uwsgi.html" title="previous chapter">uwsgi</a>
  337. <li>Next: <a href="installation-apache.html" title="next chapter">Install with apache</a></ul>
  338. </li>
  339. </ul>
  340. </li>
  341. </ul>
  342. <div id="searchbox" style="display: none" role="search">
  343. <h3 id="searchlabel">Quick search</h3>
  344. <div class="searchformwrapper">
  345. <form class="search" action="../search.html" method="get">
  346. <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
  347. <input type="submit" value="Go" />
  348. </form>
  349. </div>
  350. </div>
  351. <script>document.getElementById('searchbox').style.display = "block"</script>
  352. </div>
  353. </div>
  354. <div class="clearer"></div>
  355. </div>
  356. <div class="footer" role="contentinfo">
  357. &#169; Copyright 2015-2022, Adam Tauber, Noémi Ványi.
  358. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
  359. </div>
  360. <script src="../_static/version_warning_offset.js"></script>
  361. </body>
  362. </html>