installation-uwsgi.html 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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>uwsgi &#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 nginx" href="installation-nginx.html" />
  21. <link rel="prev" title="Step by step installation" href="installation-searx.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-nginx.html" title="Install with nginx"
  34. accesskey="N">next</a> |</li>
  35. <li class="right" >
  36. <a href="installation-searx.html" title="Step by step installation"
  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="">uwsgi</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="uwsgi">
  48. <span id="searx-uwsgi"></span><h1>uwsgi<a class="headerlink" href="#uwsgi" 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://www.freedesktop.org/software/systemd/man/systemd.unit.html">systemd.unit</a></p></li>
  53. <li><p><a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html">uWSGI Emperor</a></p></li>
  54. </ul>
  55. </aside>
  56. <nav class="contents local" id="contents">
  57. <p class="topic-title">Contents</p>
  58. <ul class="simple">
  59. <li><p><a class="reference internal" href="#origin-uwsgi" id="id1">Origin uWSGI</a></p></li>
  60. <li><p><a class="reference internal" href="#distributors" id="id2">Distributors</a></p></li>
  61. <li><p><a class="reference internal" href="#all-together" id="id3">All together</a></p></li>
  62. </ul>
  63. </nav>
  64. <section id="origin-uwsgi">
  65. <h2><a class="toc-backref" href="#id1" role="doc-backlink">Origin uWSGI</a><a class="headerlink" href="#origin-uwsgi" title="Permalink to this heading">¶</a></h2>
  66. <p>How uWSGI is implemented by distributors is different. uWSGI itself
  67. recommend two methods</p>
  68. <p><a class="reference external" href="https://www.freedesktop.org/software/systemd/man/systemd.unit.html">systemd.unit</a> template files as described here <a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd">One service per app in systemd</a>.</p>
  69. <blockquote>
  70. <div><p>There is one <a class="reference external" href="http://0pointer.de/blog/projects/instances.html">systemd unit template</a> and one <a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Configuration.html#ini-files">uwsgi ini file</a> per uWSGI-app
  71. placed at dedicated locations. Take archlinux and a searx.ini as example:</p>
  72. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>unit template --&gt; /usr/lib/systemd/system/uwsgi@.service
  73. uwsgi ini files --&gt; /etc/uwsgi/searx.ini
  74. </pre></div>
  75. </div>
  76. <p>The searx app can be maintained as know from common systemd units:</p>
  77. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>systemctl enable uwsgi@searx
  78. systemctl start uwsgi@searx
  79. systemctl restart uwsgi@searx
  80. systemctl stop uwsgi@searx
  81. </pre></div>
  82. </div>
  83. </div></blockquote>
  84. <p>The <a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html">uWSGI Emperor</a> mode which fits for maintaining a large range of uwsgi apps.</p>
  85. <blockquote>
  86. <div><p>The Emperor mode is a special uWSGI instance that will monitor specific
  87. events. The Emperor mode (service) is started by a (common, not template)
  88. systemd unit. The Emperor service will scan specific directories for <a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Configuration.html#ini-files">uwsgi
  89. ini file</a>s (also know as <em>vassals</em>). If a <em>vassal</em> is added, removed or the
  90. timestamp is modified, a corresponding action takes place: a new uWSGI
  91. instance is started, reload or stopped. Take Fedora and a searx.ini as
  92. example:</p>
  93. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>to start a new searx instance create --&gt; /etc/uwsgi.d/searx.ini
  94. to reload the instance edit timestamp --&gt; touch /etc/uwsgi.d/searx.ini
  95. to stop instance remove ini --&gt; rm /etc/uwsgi.d/searx.ini
  96. </pre></div>
  97. </div>
  98. </div></blockquote>
  99. </section>
  100. <section id="distributors">
  101. <h2><a class="toc-backref" href="#id2" role="doc-backlink">Distributors</a><a class="headerlink" href="#distributors" title="Permalink to this heading">¶</a></h2>
  102. <p>The <a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html">uWSGI Emperor</a> mode and <a class="reference external" href="http://0pointer.de/blog/projects/instances.html">systemd unit template</a> is what the distributors
  103. mostly offer their users, even if they differ in the way they implement both
  104. modes and their defaults. Another point they might differ is the packaging of
  105. plugins (if so, compare <a class="reference internal" href="installation-searx.html#install-packages"><span class="std std-ref">Install packages</span></a>) and what the default python
  106. interpreter is (python2 vs. python3).</p>
  107. <p>Fedora starts a Emperor by default, while archlinux does not start any uwsgi
  108. service by default. Worth to know; debian (ubuntu) follow a complete different
  109. approach. <em>debian</em>: your are familiar with the apache infrastructure? .. they
  110. do similar for the uWSGI infrastructure (with less comfort), the folders are:</p>
  111. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>/etc/uwsgi/apps-available/
  112. /etc/uwsgi/apps-enabled/
  113. </pre></div>
  114. </div>
  115. <p>The <a class="reference external" href="https://uwsgi-docs.readthedocs.io/en/latest/Configuration.html#ini-files">uwsgi ini file</a> is enabled by a symbolic link:</p>
  116. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/
  117. </pre></div>
  118. </div>
  119. <p>From debian’s documentation (<code class="docutils literal notranslate"><span class="pre">/usr/share/doc/uwsgi/README.Debian.gz</span></code>): You
  120. could control specific instance(s) by issuing:</p>
  121. <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>service uwsgi &lt;command&gt; &lt;confname&gt; &lt;confname&gt; ...
  122. sudo -H service uwsgi start searx
  123. sudo -H service uwsgi stop searx
  124. </pre></div>
  125. </div>
  126. <p>My experience is, that this command is a bit buggy.</p>
  127. </section>
  128. <section id="all-together">
  129. <span id="uwsgi-configuration"></span><h2><a class="toc-backref" href="#id3" role="doc-backlink">All together</a><a class="headerlink" href="#all-together" title="Permalink to this heading">¶</a></h2>
  130. <p>Create the configuration ini-file according to your distribution (see below) and
  131. restart the uwsgi application.</p>
  132. <div class="sphinx-tabs docutils container">
  133. <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-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># init.d --&gt; /usr/share/doc/uwsgi/README.Debian.gz</span>
  134. <span class="c1"># For uWSGI debian uses the LSB init process, this might be changed</span>
  135. <span class="c1"># one day, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=833067</span>
  136. create /etc/uwsgi/apps-available/searx.ini
  137. enable: sudo -H ln -s /etc/uwsgi/apps-available/searx.ini /etc/uwsgi/apps-enabled/
  138. start: sudo -H service uwsgi start searx
  139. restart: sudo -H service uwsgi restart searx
  140. stop: sudo -H service uwsgi stop searx
  141. disable: sudo -H rm /etc/uwsgi/apps-enabled/searx.ini
  142. </pre></div>
  143. </div>
  144. </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-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># systemd --&gt; /usr/lib/systemd/system/uwsgi@.service</span>
  145. <span class="c1"># For uWSGI archlinux uses systemd template units, see</span>
  146. <span class="c1"># - http://0pointer.de/blog/projects/instances.html</span>
  147. <span class="c1"># - https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd</span>
  148. create: /etc/uwsgi/searx.ini
  149. enable: sudo -H systemctl <span class="nb">enable</span> uwsgi@searx
  150. start: sudo -H systemctl start uwsgi@searx
  151. restart: sudo -H systemctl restart uwsgi@searx
  152. stop: sudo -H systemctl stop uwsgi@searx
  153. disable: sudo -H systemctl disable uwsgi@searx
  154. </pre></div>
  155. </div>
  156. </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-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># systemd --&gt; /usr/lib/systemd/system/uwsgi.service</span>
  157. <span class="c1"># The unit file starts uWSGI in emperor mode (/etc/uwsgi.ini), see</span>
  158. <span class="c1"># - https://uwsgi-docs.readthedocs.io/en/latest/Emperor.html</span>
  159. create: /etc/uwsgi.d/searx.ini
  160. restart: sudo -H touch /etc/uwsgi.d/searx.ini
  161. disable: sudo -H rm /etc/uwsgi.d/searx.ini
  162. </pre></div>
  163. </div>
  164. </div></div>
  165. <div class="sphinx-tabs docutils container">
  166. <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-bash notranslate"><div class="highlight"><pre><span></span><span class="o">[</span>uwsgi<span class="o">]</span>
  167. <span class="c1"># uWSGI core</span>
  168. <span class="c1"># ----------</span>
  169. <span class="c1">#</span>
  170. <span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core</span>
  171. <span class="c1"># Who will run the code</span>
  172. <span class="nv">uid</span> <span class="o">=</span> searx
  173. <span class="nv">gid</span> <span class="o">=</span> searx
  174. <span class="c1"># set (python) default encoding UTF-8</span>
  175. <span class="nv">env</span> <span class="o">=</span> <span class="nv">LANG</span><span class="o">=</span>C.UTF-8
  176. <span class="nv">env</span> <span class="o">=</span> <span class="nv">LANGUAGE</span><span class="o">=</span>C.UTF-8
  177. <span class="nv">env</span> <span class="o">=</span> <span class="nv">LC_ALL</span><span class="o">=</span>C.UTF-8
  178. <span class="c1"># chdir to specified directory before apps loading</span>
  179. <span class="nv">chdir</span> <span class="o">=</span> /usr/local/searx/searx-src/searx
  180. <span class="c1"># searx configuration (settings.yml)</span>
  181. <span class="nv">env</span> <span class="o">=</span> <span class="nv">SEARX_SETTINGS_PATH</span><span class="o">=</span>/etc/searx/settings.yml
  182. <span class="c1"># disable logging for privacy</span>
  183. disable-logging <span class="o">=</span> <span class="nb">true</span>
  184. <span class="c1"># The right granted on the created socket</span>
  185. chmod-socket <span class="o">=</span> <span class="m">666</span>
  186. <span class="c1"># Plugin to use and interpreter config</span>
  187. single-interpreter <span class="o">=</span> <span class="nb">true</span>
  188. <span class="c1"># enable master process</span>
  189. <span class="nv">master</span> <span class="o">=</span> <span class="nb">true</span>
  190. <span class="c1"># load apps in each worker instead of the master</span>
  191. lazy-apps <span class="o">=</span> <span class="nb">true</span>
  192. <span class="c1"># load uWSGI plugins</span>
  193. <span class="nv">plugin</span> <span class="o">=</span> python3,http
  194. <span class="c1"># By default the Python plugin does not initialize the GIL. This means your</span>
  195. <span class="c1"># app-generated threads will not run. If you need threads, remember to enable</span>
  196. <span class="c1"># them with enable-threads. Running uWSGI in multithreading mode (with the</span>
  197. <span class="c1"># threads options) will automatically enable threading support. This *strange*</span>
  198. <span class="c1"># default behaviour is for performance reasons.</span>
  199. enable-threads <span class="o">=</span> <span class="nb">true</span>
  200. <span class="c1"># plugin: python</span>
  201. <span class="c1"># --------------</span>
  202. <span class="c1">#</span>
  203. <span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python</span>
  204. <span class="c1"># load a WSGI module</span>
  205. <span class="nv">module</span> <span class="o">=</span> searx.webapp
  206. <span class="c1"># set PYTHONHOME/virtualenv</span>
  207. <span class="nv">virtualenv</span> <span class="o">=</span> /usr/local/searx/searx-pyenv
  208. <span class="c1"># add directory (or glob) to pythonpath</span>
  209. <span class="nv">pythonpath</span> <span class="o">=</span> /usr/local/searx/searx-src
  210. <span class="c1"># speak to upstream</span>
  211. <span class="c1"># -----------------</span>
  212. <span class="c1">#</span>
  213. <span class="c1"># Activate the &#39;http&#39; configuration for filtron or activate the &#39;socket&#39;</span>
  214. <span class="c1"># configuration if you setup your HTTP server to use uWSGI protocol via sockets.</span>
  215. <span class="c1"># using IP:</span>
  216. <span class="c1">#</span>
  217. <span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http</span>
  218. <span class="c1"># Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html</span>
  219. <span class="nv">http</span> <span class="o">=</span> <span class="m">127</span>.0.0.1:8888
  220. <span class="c1"># using unix-sockets:</span>
  221. <span class="c1">#</span>
  222. <span class="c1"># On some distributions you need to create the app folder for the sockets::</span>
  223. <span class="c1">#</span>
  224. <span class="c1"># mkdir -p /run/uwsgi/app/searx</span>
  225. <span class="c1"># chown -R searx:searx /run/uwsgi/app/searx</span>
  226. <span class="c1">#</span>
  227. <span class="c1"># socket = /run/uwsgi/app/searx/socket</span>
  228. <span class="c1"># Cache</span>
  229. <span class="nv">cache2</span> <span class="o">=</span> <span class="nv">name</span><span class="o">=</span>searxcache,items<span class="o">=</span><span class="m">2000</span>,blocks<span class="o">=</span><span class="m">2000</span>,blocksize<span class="o">=</span><span class="m">4096</span>,bitmap<span class="o">=</span><span class="m">1</span>
  230. </pre></div>
  231. </div>
  232. </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-bash notranslate"><div class="highlight"><pre><span></span><span class="o">[</span>uwsgi<span class="o">]</span>
  233. <span class="c1"># uWSGI core</span>
  234. <span class="c1"># ----------</span>
  235. <span class="c1">#</span>
  236. <span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core</span>
  237. <span class="c1"># Who will run the code</span>
  238. <span class="nv">uid</span> <span class="o">=</span> searx
  239. <span class="nv">gid</span> <span class="o">=</span> searx
  240. <span class="c1"># set (python) default encoding UTF-8</span>
  241. <span class="nv">env</span> <span class="o">=</span> <span class="nv">LANG</span><span class="o">=</span>C.UTF-8
  242. <span class="nv">env</span> <span class="o">=</span> <span class="nv">LANGUAGE</span><span class="o">=</span>C.UTF-8
  243. <span class="nv">env</span> <span class="o">=</span> <span class="nv">LC_ALL</span><span class="o">=</span>C.UTF-8
  244. <span class="c1"># chdir to specified directory before apps loading</span>
  245. <span class="nv">chdir</span> <span class="o">=</span> /usr/local/searx/searx-src/searx
  246. <span class="c1"># searx configuration (settings.yml)</span>
  247. <span class="nv">env</span> <span class="o">=</span> <span class="nv">SEARX_SETTINGS_PATH</span><span class="o">=</span>/etc/searx/settings.yml
  248. <span class="c1"># disable logging for privacy</span>
  249. <span class="nv">logger</span> <span class="o">=</span> systemd
  250. disable-logging <span class="o">=</span> <span class="nb">true</span>
  251. <span class="c1"># The right granted on the created socket</span>
  252. chmod-socket <span class="o">=</span> <span class="m">666</span>
  253. <span class="c1"># Plugin to use and interpreter config</span>
  254. single-interpreter <span class="o">=</span> <span class="nb">true</span>
  255. <span class="c1"># enable master process</span>
  256. <span class="nv">master</span> <span class="o">=</span> <span class="nb">true</span>
  257. <span class="c1"># load apps in each worker instead of the master</span>
  258. lazy-apps <span class="o">=</span> <span class="nb">true</span>
  259. <span class="c1"># load uWSGI plugins</span>
  260. <span class="nv">plugin</span> <span class="o">=</span> python
  261. <span class="c1"># By default the Python plugin does not initialize the GIL. This means your</span>
  262. <span class="c1"># app-generated threads will not run. If you need threads, remember to enable</span>
  263. <span class="c1"># them with enable-threads. Running uWSGI in multithreading mode (with the</span>
  264. <span class="c1"># threads options) will automatically enable threading support. This *strange*</span>
  265. <span class="c1"># default behaviour is for performance reasons.</span>
  266. enable-threads <span class="o">=</span> <span class="nb">true</span>
  267. <span class="c1"># plugin: python</span>
  268. <span class="c1"># --------------</span>
  269. <span class="c1">#</span>
  270. <span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python</span>
  271. <span class="c1"># load a WSGI module</span>
  272. <span class="nv">module</span> <span class="o">=</span> searx.webapp
  273. <span class="c1"># set PYTHONHOME/virtualenv</span>
  274. <span class="nv">virtualenv</span> <span class="o">=</span> /usr/local/searx/searx-pyenv
  275. <span class="c1"># add directory (or glob) to pythonpath</span>
  276. <span class="nv">pythonpath</span> <span class="o">=</span> /usr/local/searx/searx-src
  277. <span class="c1"># speak to upstream</span>
  278. <span class="c1"># -----------------</span>
  279. <span class="c1">#</span>
  280. <span class="c1"># Activate the &#39;http&#39; configuration for filtron or activate the &#39;socket&#39;</span>
  281. <span class="c1"># configuration if you setup your HTTP server to use uWSGI protocol via sockets.</span>
  282. <span class="c1"># using IP:</span>
  283. <span class="c1">#</span>
  284. <span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http</span>
  285. <span class="c1"># Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html</span>
  286. <span class="nv">http</span> <span class="o">=</span> <span class="m">127</span>.0.0.1:8888
  287. <span class="c1"># using unix-sockets:</span>
  288. <span class="c1">#</span>
  289. <span class="c1"># On some distributions you need to create the app folder for the sockets::</span>
  290. <span class="c1">#</span>
  291. <span class="c1"># mkdir -p /run/uwsgi/app/searx</span>
  292. <span class="c1"># chown -R searx:searx /run/uwsgi/app/searx</span>
  293. <span class="c1">#</span>
  294. <span class="c1"># socket = /run/uwsgi/app/searx/socket</span>
  295. <span class="c1"># Cache</span>
  296. <span class="nv">cache2</span> <span class="o">=</span> <span class="nv">name</span><span class="o">=</span>searxcache,items<span class="o">=</span><span class="m">2000</span>,blocks<span class="o">=</span><span class="m">2000</span>,blocksize<span class="o">=</span><span class="m">4096</span>,bitmap<span class="o">=</span><span class="m">1</span>
  297. </pre></div>
  298. </div>
  299. </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-bash notranslate"><div class="highlight"><pre><span></span><span class="o">[</span>uwsgi<span class="o">]</span>
  300. <span class="c1"># uWSGI core</span>
  301. <span class="c1"># ----------</span>
  302. <span class="c1">#</span>
  303. <span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core</span>
  304. <span class="c1"># Who will run the code</span>
  305. <span class="nv">uid</span> <span class="o">=</span> searx
  306. <span class="nv">gid</span> <span class="o">=</span> searx
  307. <span class="c1"># set (python) default encoding UTF-8</span>
  308. <span class="nv">env</span> <span class="o">=</span> <span class="nv">LANG</span><span class="o">=</span>C.UTF-8
  309. <span class="nv">env</span> <span class="o">=</span> <span class="nv">LANGUAGE</span><span class="o">=</span>C.UTF-8
  310. <span class="nv">env</span> <span class="o">=</span> <span class="nv">LC_ALL</span><span class="o">=</span>C.UTF-8
  311. <span class="c1"># chdir to specified directory before apps loading</span>
  312. <span class="nv">chdir</span> <span class="o">=</span> /usr/local/searx/searx-src/searx
  313. <span class="c1"># searx configuration (settings.yml)</span>
  314. <span class="nv">env</span> <span class="o">=</span> <span class="nv">SEARX_SETTINGS_PATH</span><span class="o">=</span>/etc/searx/settings.yml
  315. <span class="c1"># disable logging for privacy</span>
  316. disable-logging <span class="o">=</span> <span class="nb">true</span>
  317. <span class="c1"># The right granted on the created socket</span>
  318. chmod-socket <span class="o">=</span> <span class="m">666</span>
  319. <span class="c1"># Plugin to use and interpreter config</span>
  320. single-interpreter <span class="o">=</span> <span class="nb">true</span>
  321. <span class="c1"># enable master process</span>
  322. <span class="nv">master</span> <span class="o">=</span> <span class="nb">true</span>
  323. <span class="c1"># load apps in each worker instead of the master</span>
  324. lazy-apps <span class="o">=</span> <span class="nb">true</span>
  325. <span class="c1"># load uWSGI plugins</span>
  326. <span class="nv">plugin</span> <span class="o">=</span> python3,http
  327. <span class="c1"># By default the Python plugin does not initialize the GIL. This means your</span>
  328. <span class="c1"># app-generated threads will not run. If you need threads, remember to enable</span>
  329. <span class="c1"># them with enable-threads. Running uWSGI in multithreading mode (with the</span>
  330. <span class="c1"># threads options) will automatically enable threading support. This *strange*</span>
  331. <span class="c1"># default behaviour is for performance reasons.</span>
  332. enable-threads <span class="o">=</span> <span class="nb">true</span>
  333. <span class="c1"># plugin: python</span>
  334. <span class="c1"># --------------</span>
  335. <span class="c1">#</span>
  336. <span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python</span>
  337. <span class="c1"># load a WSGI module</span>
  338. <span class="nv">module</span> <span class="o">=</span> searx.webapp
  339. <span class="c1"># set PYTHONHOME/virtualenv</span>
  340. <span class="nv">virtualenv</span> <span class="o">=</span> /usr/local/searx/searx-pyenv
  341. <span class="c1"># add directory (or glob) to pythonpath</span>
  342. <span class="nv">pythonpath</span> <span class="o">=</span> /usr/local/searx/searx-src
  343. <span class="c1"># speak to upstream</span>
  344. <span class="c1"># -----------------</span>
  345. <span class="c1">#</span>
  346. <span class="c1"># Activate the &#39;http&#39; configuration for filtron or activate the &#39;socket&#39;</span>
  347. <span class="c1"># configuration if you setup your HTTP server to use uWSGI protocol via sockets.</span>
  348. <span class="c1"># using IP:</span>
  349. <span class="c1">#</span>
  350. <span class="c1"># https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http</span>
  351. <span class="c1"># Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html</span>
  352. <span class="nv">http</span> <span class="o">=</span> <span class="m">127</span>.0.0.1:8888
  353. <span class="c1"># using unix-sockets:</span>
  354. <span class="c1">#</span>
  355. <span class="c1"># On some distributions you need to create the app folder for the sockets::</span>
  356. <span class="c1">#</span>
  357. <span class="c1"># mkdir -p /run/uwsgi/app/searx</span>
  358. <span class="c1"># chown -R searx:searx /run/uwsgi/app/searx</span>
  359. <span class="c1">#</span>
  360. <span class="c1"># socket = /run/uwsgi/app/searx/socket</span>
  361. <span class="c1"># Cache</span>
  362. <span class="nv">cache2</span> <span class="o">=</span> <span class="nv">name</span><span class="o">=</span>searxcache,items<span class="o">=</span><span class="m">2000</span>,blocks<span class="o">=</span><span class="m">2000</span>,blocksize<span class="o">=</span><span class="m">4096</span>,bitmap<span class="o">=</span><span class="m">1</span>
  363. </pre></div>
  364. </div>
  365. </div></div>
  366. </section>
  367. </section>
  368. <div class="clearer"></div>
  369. </div>
  370. </div>
  371. </div>
  372. <span id="sidebar-top"></span>
  373. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  374. <div class="sphinxsidebarwrapper">
  375. <p class="logo"><a href="../index.html">
  376. <img class="logo" src="../_static/searx_logo_small.png" alt="Logo"/>
  377. </a></p>
  378. <h3>Project Links</h3>
  379. <ul>
  380. <li><a href="https://searx.github.io/searx/blog/index.html">Blog</a>
  381. <li><a href="https://github.com/searx/searx">Source</a>
  382. <li><a href="https://github.com/searx/searx/wiki">Wiki</a>
  383. <li><a href="https://twitter.com/Searx_engine">Twitter</a>
  384. <li><a href="https://github.com/searx/searx/issues">Issue Tracker</a>
  385. </ul><h3>Navigation</h3>
  386. <ul>
  387. <li><a href="../index.html">Overview</a>
  388. <ul>
  389. <li><a href="index.html">Administrator documentation</a>
  390. <ul>
  391. <li>Previous: <a href="installation-searx.html" title="previous chapter">Step by step installation</a>
  392. <li>Next: <a href="installation-nginx.html" title="next chapter">Install with nginx</a></ul>
  393. </li>
  394. </ul>
  395. </li>
  396. </ul>
  397. <div id="searchbox" style="display: none" role="search">
  398. <h3 id="searchlabel">Quick search</h3>
  399. <div class="searchformwrapper">
  400. <form class="search" action="../search.html" method="get">
  401. <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
  402. <input type="submit" value="Go" />
  403. </form>
  404. </div>
  405. </div>
  406. <script>document.getElementById('searchbox').style.display = "block"</script>
  407. </div>
  408. </div>
  409. <div class="clearer"></div>
  410. </div>
  411. <div class="footer" role="contentinfo">
  412. &#169; Copyright 2015-2022, Adam Tauber, Noémi Ványi.
  413. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
  414. </div>
  415. <script src="../_static/version_warning_offset.js"></script>
  416. </body>
  417. </html>