settings.rst 12 KB

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