settings.rst 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. .. _settings.yml:
  2. ================
  3. ``settings.yml``
  4. ================
  5. This page describe the options possibilities of the :origin:`searx/settings.yml`
  6. file.
  7. .. sidebar:: Further reading ..
  8. - :ref:`use_default_settings.yml`
  9. - :ref:`search API`
  10. .. contents:: Contents
  11. :depth: 2
  12. :local:
  13. :backlinks: entry
  14. .. _settings location:
  15. settings.yml location
  16. =====================
  17. First, searx will try to load settings.yml from these locations:
  18. 1. the full path specified in the ``SEARX_SETTINGS_PATH`` environment variable.
  19. 2. ``/etc/searx/settings.yml``
  20. If these files don't exist (or are empty or can't be read), searx uses the :origin:`searx/settings.yml` file.
  21. .. _settings global:
  22. Global Settings
  23. ===============
  24. .. code:: yaml
  25. general:
  26. debug : False # Debug mode, only for development
  27. instance_name : "searx" # displayed name
  28. ``debug`` :
  29. Allow a more detailed log if you run searx directly. Display *detailed* error
  30. messages in the browser too, so this must be deactivated in production.
  31. .. code:: yaml
  32. server:
  33. port : 8888
  34. bind_address : "127.0.0.1" # address to listen on
  35. secret_key : "ultrasecretkey" # change this!
  36. base_url : False # set custom base_url (or False)
  37. image_proxy : False # proxying image results through searx
  38. default_locale : "" # default interface locale
  39. default_theme : oscar # ui theme
  40. default_http_headers:
  41. X-Content-Type-Options : nosniff
  42. X-XSS-Protection : 1; mode=block
  43. X-Download-Options : noopen
  44. X-Robots-Tag : noindex, nofollow
  45. Referrer-Policy : no-referrer
  46. ``port`` & ``bind_address``:
  47. Port number and *bind address* of the searx web application if you run it
  48. directly using ``python searx/webapp.py``. Doesn't apply to searx running on
  49. Apache or Nginx.
  50. ``secret_key`` :
  51. Used for cryptography purpose.
  52. ``base_url`` :
  53. The base URL where searx is deployed. Used to create correct inbound links.
  54. ``image_proxy`` :
  55. Allow your instance of searx of being able to proxy images. Uses memory space.
  56. ``default_locale`` :
  57. Searx interface language. If blank, the locale is detected by using the
  58. browser language. If it doesn't work, or you are deploying a language
  59. specific instance of searx, a locale can be defined using an ISO language
  60. code, like ``fr``, ``en``, ``de``.
  61. ``default_theme`` :
  62. Name of the theme you want to use by default on your searx instance.
  63. .. _HTTP headers: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
  64. ``default_http_headers``:
  65. Set additional HTTP headers, see `#755 <https://github.com/searx/searx/issues/715>`__
  66. .. code:: yaml
  67. outgoing: # communication with search engines
  68. request_timeout : 2.0 # default timeout in seconds, can be override by engine
  69. # max_request_timeout: 10.0 # the maximum timeout in seconds
  70. useragent_suffix : "" # informations like an email address to the administrator
  71. pool_connections : 100 # Number of different hosts
  72. pool_maxsize : 10 # Number of simultaneous requests by host
  73. # uncomment below section if you want to use a proxy
  74. # proxies:
  75. # http:
  76. # - http://proxy1:8080
  77. # - http://proxy2:8080
  78. # https:
  79. # - http://proxy1:8080
  80. # - http://proxy2:8080
  81. # uncomment below section only if you have more than one network interface
  82. # which can be the source of outgoing search requests
  83. # source_ips:
  84. # - 1.1.1.1
  85. # - 1.1.1.2
  86. ``request_timeout`` :
  87. Global timeout of the requests made to others engines in seconds. A bigger
  88. timeout will allow to wait for answers from slow engines, but in consequence
  89. will slow searx reactivity (the result page may take the time specified in the
  90. timeout to load). Can be override by :ref:`settings engine`
  91. ``useragent_suffix`` :
  92. Suffix to the user-agent searx uses to send requests to others engines. If an
  93. engine wish to block you, a contact info here may be useful to avoid that.
  94. .. _requests proxies: https://requests.readthedocs.io/en/latest/user/advanced/#proxies
  95. .. _PySocks: https://pypi.org/project/PySocks/
  96. ``proxies`` :
  97. Define one or more proxies you wish to use, see `requests proxies`_.
  98. If there are more than one proxy for one protocol (http, https),
  99. requests to the engines are distributed in a round-robin fashion.
  100. - Proxy: `see <https://2.python-requests.org/en/latest/user/advanced/#proxies>`__.
  101. - SOCKS proxies are also supported: `see <https://2.python-requests.org/en/latest/user/advanced/#socks>`__
  102. ``source_ips`` :
  103. If you use multiple network interfaces, define from which IP the requests must
  104. be made. This parameter is ignored when ``proxies`` is set.
  105. .. code:: yaml
  106. locales:
  107. en : English
  108. de : Deutsch
  109. he : Hebrew
  110. hu : Magyar
  111. fr : Français
  112. es : Español
  113. it : Italiano
  114. nl : Nederlands
  115. ja : 日本語 (Japanese)
  116. tr : Türkçe
  117. ru : Russian
  118. ro : Romanian
  119. ``locales`` :
  120. Locales codes and their names. Available translations of searx interface.
  121. .. _settings engine:
  122. Engine settings
  123. ===============
  124. .. sidebar:: Further reading ..
  125. - :ref:`engines-dev`
  126. .. code:: yaml
  127. - name : bing
  128. engine : bing
  129. shortcut : bi
  130. base_url : 'https://{language}.wikipedia.org/'
  131. categories : general
  132. timeout : 3.0
  133. api_key : 'apikey'
  134. disabled : True
  135. language : en_US
  136. #proxies:
  137. # http:
  138. # - http://proxy1:8080
  139. # - http://proxy2:8080
  140. # https:
  141. # - http://proxy1:8080
  142. # - http://proxy2:8080
  143. # - socks5://user:password@proxy3:1080
  144. # - socks5h://user:password@proxy4:1080
  145. ``name`` :
  146. Name that will be used across searx to define this engine. In settings, on
  147. the result page...
  148. ``engine`` :
  149. Name of the python file used to handle requests and responses to and from this
  150. search engine.
  151. ``shortcut`` :
  152. Code used to execute bang requests (in this case using ``!bi`` or ``?bi``)
  153. ``base_url`` : optional
  154. Part of the URL that should be stable across every request. Can be useful to
  155. use multiple sites using only one engine, or updating the site URL without
  156. touching at the code.
  157. ``categories`` : optional
  158. Define in which categories this engine will be active. Most of the time, it is
  159. defined in the code of the engine, but in a few cases it is useful, like when
  160. describing multiple search engine using the same code.
  161. ``timeout`` : optional
  162. Timeout of the search with the current search engine. **Be careful, it will
  163. modify the global timeout of searx.**
  164. ``api_key`` : optional
  165. In a few cases, using an API needs the use of a secret key. How to obtain them
  166. is described in the file.
  167. ``disabled`` : optional
  168. To disable by default the engine, but not deleting it. It will allow the user
  169. to manually activate it in the settings.
  170. ``language`` : optional
  171. If you want to use another language for a specific engine, you can define it
  172. by using the full ISO code of language and country, like ``fr_FR``, ``en_US``,
  173. ``de_DE``.
  174. ``weigth`` : default ``1``
  175. Weighting of the results of this engine.
  176. ``display_error_messages`` : default ``True``
  177. When an engine returns an error, the message is displayed on the user interface.
  178. .. note::
  179. A few more options are possible, but they are pretty specific to some
  180. engines, and so won't be described here.
  181. .. _settings use_default_settings:
  182. use_default_settings
  183. ====================
  184. .. note::
  185. If searx is cloned from a git repository, most probably there is no need to have an user settings.
  186. The user defined settings.yml can relied on the default configuration :origin:`searx/settings.yml` using ``use_default_settings: True``.
  187. In the following example, the actual settings are the default settings defined in :origin:`searx/settings.yml` with the exception of the ``secret_key`` and the ``bind_address``:
  188. .. code-block:: yaml
  189. use_default_settings: True
  190. server:
  191. secret_key: "uvys6bRhKHUdFF5CqbJonSDSRN8H0sCBziNSrDGNVdpz7IeZhveVart3yvghoKHA"
  192. bind_address: "0.0.0.0"
  193. With ``use_default_settings: True``, each settings can be override in a similar way, the ``engines`` section is merged according to the engine ``name``.
  194. In this example, searx will load all the engine and the arch linux wiki engine has a :ref:`token<private engines>`:
  195. .. code-block:: yaml
  196. use_default_settings: True
  197. server:
  198. secret_key: "uvys6bRhKHUdFF5CqbJonSDSRN8H0sCBziNSrDGNVdpz7IeZhveVart3yvghoKHA"
  199. engines:
  200. - name: arch linux wiki
  201. tokens: ['$ecretValue']
  202. It is possible to remove some engines from the default settings. The following example is similar to the above one, but searx doesn't load the the google engine:
  203. .. code-block:: yaml
  204. use_default_settings:
  205. engines:
  206. remove:
  207. - google
  208. server:
  209. secret_key: "uvys6bRhKHUdFF5CqbJonSDSRN8H0sCBziNSrDGNVdpz7IeZhveVart3yvghoKHA"
  210. engines:
  211. - name: arch linux wiki
  212. tokens: ['$ecretValue']
  213. As an alternative, it is possible to specify the engines to keep. In the following example, searx has only two engines:
  214. .. code-block:: yaml
  215. use_default_settings:
  216. engines:
  217. keep_only:
  218. - google
  219. - duckduckgo
  220. server:
  221. secret_key: "uvys6bRhKHUdFF5CqbJonSDSRN8H0sCBziNSrDGNVdpz7IeZhveVart3yvghoKHA"
  222. engines:
  223. - name: google
  224. tokens: ['$ecretValue']
  225. - name: duckduckgo
  226. tokens: ['$ecretValue']