settings.rst 10 KB

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