settings.rst 9.6 KB

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