index.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. <!DOCTYPE html>
  2. <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
  3. <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <link rel="shortcut icon" href="../img/favicon.ico">
  9. <title>Shaarli configuration - Shaarli Documentation</title>
  10. <link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
  11. <link rel="stylesheet" href="../css/theme.css" type="text/css" />
  12. <link rel="stylesheet" href="../css/theme_extra.css" type="text/css" />
  13. <link rel="stylesheet" href="../css/highlight.css">
  14. <link href="../github-markdown.css" rel="stylesheet">
  15. <script>
  16. // Current page data
  17. var mkdocs_page_name = "Shaarli configuration";
  18. var mkdocs_page_input_path = "Shaarli-configuration.md";
  19. var mkdocs_page_url = "/Shaarli-configuration/";
  20. </script>
  21. <script src="../js/jquery-2.1.1.min.js"></script>
  22. <script src="../js/modernizr-2.8.3.min.js"></script>
  23. <script type="text/javascript" src="../js/highlight.pack.js"></script>
  24. </head>
  25. <body class="wy-body-for-nav" role="document">
  26. <div class="wy-grid-for-nav">
  27. <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
  28. <div class="wy-side-nav-search">
  29. <a href=".." class="icon icon-home"> Shaarli Documentation</a>
  30. <div role="search">
  31. <form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
  32. <input type="text" name="q" placeholder="Search docs" />
  33. </form>
  34. </div>
  35. </div>
  36. <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
  37. <ul class="current">
  38. <li class="toctree-l1">
  39. <a class="" href="..">Home</a>
  40. </li>
  41. <li class="toctree-l1">
  42. <span class="caption-text">Setup</span>
  43. <ul class="subnav">
  44. <li class="">
  45. <a class="" href="../Download-and-Installation/">Download and Installation</a>
  46. </li>
  47. <li class="">
  48. <a class="" href="../Upgrade-and-migration/">Upgrade and migration</a>
  49. </li>
  50. <li class="">
  51. <a class="" href="../Server-requirements/">Server requirements</a>
  52. </li>
  53. <li class="">
  54. <a class="" href="../Server-configuration/">Server configuration</a>
  55. </li>
  56. <li class="">
  57. <a class="" href="../Server-security/">Server security</a>
  58. </li>
  59. <li class=" current">
  60. <a class="current" href="./">Shaarli configuration</a>
  61. <ul class="subnav">
  62. <li class="toctree-l3"><a href="#foreword">Foreword</a></li>
  63. <li class="toctree-l3"><a href="#file-and-directory-permissions">File and directory permissions</a></li>
  64. <li class="toctree-l3"><a href="#configuration">Configuration</a></li>
  65. <ul>
  66. <li><a class="toctree-l4" href="#credentials">Credentials</a></li>
  67. <li><a class="toctree-l4" href="#general">General</a></li>
  68. <li><a class="toctree-l4" href="#security">Security</a></li>
  69. <li><a class="toctree-l4" href="#resources">Resources</a></li>
  70. <li><a class="toctree-l4" href="#updates">Updates</a></li>
  71. <li><a class="toctree-l4" href="#privacy">Privacy</a></li>
  72. <li><a class="toctree-l4" href="#feed">Feed</a></li>
  73. <li><a class="toctree-l4" href="#thumbnail">Thumbnail</a></li>
  74. <li><a class="toctree-l4" href="#redirector">Redirector</a></li>
  75. </ul>
  76. <li class="toctree-l3"><a href="#configuration-file-example">Configuration file example</a></li>
  77. <li class="toctree-l3"><a href="#additional-configuration">Additional configuration</a></li>
  78. </ul>
  79. </li>
  80. <li class="">
  81. <a class="" href="../Plugins/">Plugins</a>
  82. </li>
  83. </ul>
  84. </li>
  85. <li class="toctree-l1">
  86. <span class="caption-text">Docker</span>
  87. <ul class="subnav">
  88. <li class="">
  89. <a class="" href="../docker/docker-101/">Docker 101</a>
  90. </li>
  91. <li class="">
  92. <a class="" href="../docker/shaarli-images/">Shaarli images</a>
  93. </li>
  94. <li class="">
  95. <a class="" href="../docker/reverse-proxy-configuration/">Reverse proxy configuration</a>
  96. </li>
  97. <li class="">
  98. <a class="" href="../docker/resources/">Docker resources</a>
  99. </li>
  100. </ul>
  101. </li>
  102. <li class="toctree-l1">
  103. <span class="caption-text">Usage</span>
  104. <ul class="subnav">
  105. <li class="">
  106. <a class="" href="../Features/">Features</a>
  107. </li>
  108. <li class="">
  109. <a class="" href="../Bookmarklet/">Bookmarklet</a>
  110. </li>
  111. <li class="">
  112. <a class="" href="../Browsing-and-searching/">Browsing and searching</a>
  113. </li>
  114. <li class="">
  115. <a class="" href="../Firefox-share/">Firefox share</a>
  116. </li>
  117. <li class="">
  118. <a class="" href="../RSS-feeds/">RSS feeds</a>
  119. </li>
  120. <li class="">
  121. <a class="" href="../REST-API/">REST API</a>
  122. </li>
  123. </ul>
  124. </li>
  125. <li class="toctree-l1">
  126. <span class="caption-text">How To</span>
  127. <ul class="subnav">
  128. <li class="">
  129. <a class="" href="../Backup,-restore,-import-and-export/">Backup, restore, import and export</a>
  130. </li>
  131. <li class="">
  132. <a class="" href="../Various-hacks/">Various hacks</a>
  133. </li>
  134. </ul>
  135. </li>
  136. <li class="toctree-l1">
  137. <a class="" href="../Troubleshooting/">Troubleshooting</a>
  138. </li>
  139. <li class="toctree-l1">
  140. <span class="caption-text">Development</span>
  141. <ul class="subnav">
  142. <li class="">
  143. <a class="" href="../Development-guidelines/">Development guidelines</a>
  144. </li>
  145. <li class="">
  146. <a class="" href="../Continuous-integration-tools/">Continuous integration tools</a>
  147. </li>
  148. <li class="">
  149. <a class="" href="../GnuPG-signature/">GnuPG signature</a>
  150. </li>
  151. <li class="">
  152. <a class="" href="../Coding-guidelines/">Coding guidelines</a>
  153. </li>
  154. <li class="">
  155. <a class="" href="../Directory-structure/">Directory structure</a>
  156. </li>
  157. <li class="">
  158. <a class="" href="../3rd-party-libraries/">3rd party libraries</a>
  159. </li>
  160. <li class="">
  161. <a class="" href="../Plugin-System/">Plugin System</a>
  162. </li>
  163. <li class="">
  164. <a class="" href="../Release-Shaarli/">Release Shaarli</a>
  165. </li>
  166. <li class="">
  167. <a class="" href="../Versioning-and-Branches/">Versioning and Branches</a>
  168. </li>
  169. <li class="">
  170. <a class="" href="../Security/">Security</a>
  171. </li>
  172. <li class="">
  173. <a class="" href="../Static-analysis/">Static analysis</a>
  174. </li>
  175. <li class="">
  176. <a class="" href="../Theming/">Theming</a>
  177. </li>
  178. <li class="">
  179. <a class="" href="../Unit-tests/">Unit tests</a>
  180. </li>
  181. </ul>
  182. </li>
  183. <li class="toctree-l1">
  184. <span class="caption-text">About</span>
  185. <ul class="subnav">
  186. <li class="">
  187. <a class="" href="../FAQ/">FAQ</a>
  188. </li>
  189. <li class="">
  190. <a class="" href="../Community-&-Related-software/">Community & Related software</a>
  191. </li>
  192. </ul>
  193. </li>
  194. </ul>
  195. </div>
  196. &nbsp;
  197. </nav>
  198. <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
  199. <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
  200. <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
  201. <a href="..">Shaarli Documentation</a>
  202. </nav>
  203. <div class="wy-nav-content">
  204. <div class="rst-content">
  205. <div role="navigation" aria-label="breadcrumbs navigation">
  206. <ul class="wy-breadcrumbs">
  207. <li><a href="..">Docs</a> &raquo;</li>
  208. <li>Setup &raquo;</li>
  209. <li>Shaarli configuration</li>
  210. <li class="wy-breadcrumbs-aside">
  211. <a href="https://github.com/shaarli/Shaarli/edit/master/docs/Shaarli-configuration.md"
  212. class="icon icon-github"> Edit on GitHub</a>
  213. </li>
  214. </ul>
  215. <hr/>
  216. </div>
  217. <div role="main">
  218. <div class="section">
  219. <h2 id="foreword">Foreword</h2>
  220. <p><strong>Do not edit configuration options in index.php! Your changes would be lost.</strong> </p>
  221. <p>Once your Shaarli instance is installed, the file <code>data/config.json.php</code> is generated:
  222. <em> it contains all settings in JSON format, and can be edited to customize values
  223. </em> it defines which <a href="../Plugin-System">plugins</a> are enabled<a href="../.html"></a>
  224. <em> its values override those defined in <code>index.php</code>
  225. </em> it is wrap in a PHP comment to prevent anyone accessing it, regardless of server configuration</p>
  226. <h2 id="file-and-directory-permissions">File and directory permissions</h2>
  227. <p>The server process running Shaarli must have:</p>
  228. <ul>
  229. <li><code>read</code> access to the following resources:<ul>
  230. <li>PHP scripts: <code>index.php</code>, <code>application/*.php</code>, <code>plugins/*.php</code></li>
  231. <li>3rd party PHP and Javascript libraries: <code>inc/*.php</code>, <code>inc/*.js</code></li>
  232. <li>static assets:<ul>
  233. <li>CSS stylesheets: <code>inc/*.css</code></li>
  234. <li><code>images/*</code></li>
  235. </ul>
  236. </li>
  237. <li>RainTPL templates: <code>tpl/*.html</code></li>
  238. </ul>
  239. </li>
  240. <li><code>read</code>, <code>write</code> and <code>execution</code> access to the following directories:<ul>
  241. <li><code>cache</code> - thumbnail cache</li>
  242. <li><code>data</code> - link data store, configuration options</li>
  243. <li><code>pagecache</code> - Atom/RSS feed cache</li>
  244. <li><code>tmp</code> - RainTPL page cache</li>
  245. </ul>
  246. </li>
  247. </ul>
  248. <p>On a Linux distribution:</p>
  249. <ul>
  250. <li>the web server user will likely be <code>www</code> or <code>http</code> (for Apache2)</li>
  251. <li>it will be a member of a group of the same name: <code>www:www</code>, <code>http:http</code></li>
  252. <li>to give it access to Shaarli, either:<ul>
  253. <li>unzip Shaarli in the default web server location (usually <code>/var/www/</code>) and set the web server user as the owner</li>
  254. <li>put users in the same group as the web server, and set the appropriate access rights</li>
  255. </ul>
  256. </li>
  257. <li>if you have a domain / subdomain to serve Shaarli, <a href="../Server-configuration">configure the server</a> accordingly<a href="../.html"></a></li>
  258. </ul>
  259. <h2 id="configuration">Configuration</h2>
  260. <p>In <code>data/config.json.php</code>.</p>
  261. <p>See also <a href="../Plugin-System.html">Plugin System</a>.</p>
  262. <h3 id="credentials">Credentials</h3>
  263. <blockquote>
  264. <p>You shouldn't edit those.</p>
  265. </blockquote>
  266. <p><strong>login</strong>: Login username.<br />
  267. <strong>hash</strong>: Generated password hash.<br />
  268. <strong>salt</strong>: Password salt.</p>
  269. <h3 id="general">General</h3>
  270. <p><strong>title</strong>: Shaarli's instance title.<br />
  271. <strong>header_link</strong>: Link to the homepage.<br />
  272. <strong>links_per_page</strong>: Number of shaares displayed per page.<br />
  273. <strong>timezone</strong>: See <a href="http://php.net/manual/en/timezones.php">the list of supported timezones</a>.<br />
  274. <strong>enabled_plugins</strong>: List of enabled plugins.</p>
  275. <h3 id="security">Security</h3>
  276. <p><strong>session_protection_disabled</strong>: Disable session cookie hijacking protection (not recommended).
  277. It might be useful if your IP adress often changes.<br />
  278. <strong>ban_after</strong>: Failed login attempts before being IP banned.<br />
  279. <strong>ban_duration</strong>: IP ban duration in seconds.<br />
  280. <strong>open_shaarli</strong>: Anyone can add a new link while logged out if enabled.<br />
  281. <strong>trusted_proxies</strong>: List of trusted IP which won't be banned after failed login attemps. Useful if Shaarli is behind a reverse proxy.<br />
  282. <strong>allowed_protocols</strong>: List of allowed protocols in shaare URLs or markdown-rendered descriptions. Useful if you want to store <code>javascript:</code> links (bookmarklets) in Shaarli (default: <code>["ftp", "ftps", "magnet"]</code>).</p>
  283. <h3 id="resources">Resources</h3>
  284. <p><strong>data_dir</strong>: Data directory.<br />
  285. <strong>datastore</strong>: Shaarli's links database file path.<br />
  286. <strong>history</strong>: Shaarli's operation history file path.
  287. <strong>updates</strong>: File path for the ran updates file.<br />
  288. <strong>log</strong>: Log file path.<br />
  289. <strong>update_check</strong>: Last update check file path.<br />
  290. <strong>raintpl_tpl</strong>: Templates directory.<br />
  291. <strong>raintpl_tmp</strong>: Template engine cache directory.<br />
  292. <strong>thumbnails_cache</strong>: Thumbnails cache directory.<br />
  293. <strong>page_cache</strong>: Shaarli's internal cache directory.<br />
  294. <strong>ban_file</strong>: Banned IP file path.</p>
  295. <h3 id="updates">Updates</h3>
  296. <p><strong>check_updates</strong>: Enable or disable update check to the git repository.<br />
  297. <strong>check_updates_branch</strong>: Git branch used to check updates (e.g. <code>stable</code> or <code>master</code>).<br />
  298. <strong>check_updates_interval</strong>: Look for new version every N seconds (default: every day).</p>
  299. <h3 id="privacy">Privacy</h3>
  300. <p><strong>default_private_links</strong>: Check the private checkbox by default for every new link.<br />
  301. <strong>hide_public_links</strong>: All links are hidden while logged out.<br />
  302. <strong>hide_timestamps</strong>: Timestamps are hidden.</p>
  303. <h3 id="feed">Feed</h3>
  304. <p><strong>rss_permalinks</strong>: Enable this to redirect RSS links to Shaarli's permalinks instead of shaared URL.<br />
  305. <strong>show_atom</strong>: Display ATOM feed button.</p>
  306. <h3 id="thumbnail">Thumbnail</h3>
  307. <p><strong>enable_thumbnails</strong>: Enable or disable thumbnail display.<br />
  308. <strong>enable_localcache</strong>: Enable or disable local cache.</p>
  309. <h3 id="redirector">Redirector</h3>
  310. <p><strong>url</strong>: Redirector URL, such as <code>anonym.to</code>.<br />
  311. <strong>encode_url</strong>: Enable this if the redirector needs encoded URL to work properly.</p>
  312. <h2 id="configuration-file-example">Configuration file example</h2>
  313. <pre><code class="json">&lt;?php /*
  314. {
  315. &quot;credentials&quot;: {
  316. &quot;login&quot;: &quot;&lt;login&gt;&quot;,
  317. &quot;hash&quot;: &quot;&lt;password hash&gt;&quot;,
  318. &quot;salt&quot;: &quot;&lt;password salt&gt;&quot;
  319. },
  320. &quot;security&quot;: {
  321. &quot;ban_after&quot;: 4,
  322. &quot;session_protection_disabled&quot;: false,
  323. &quot;ban_duration&quot;: 1800,
  324. &quot;trusted_proxies&quot;: [
  325. &quot;1.2.3.4&quot;,
  326. &quot;5.6.7.8&quot;
  327. ],
  328. &quot;allowed_protocols&quot;: [
  329. &quot;ftp&quot;,
  330. &quot;ftps&quot;,
  331. &quot;magnet&quot;
  332. ]
  333. },
  334. &quot;resources&quot;: {
  335. &quot;data_dir&quot;: &quot;data&quot;,
  336. &quot;config&quot;: &quot;data\/config.php&quot;,
  337. &quot;datastore&quot;: &quot;data\/datastore.php&quot;,
  338. &quot;ban_file&quot;: &quot;data\/ipbans.php&quot;,
  339. &quot;updates&quot;: &quot;data\/updates.txt&quot;,
  340. &quot;log&quot;: &quot;data\/log.txt&quot;,
  341. &quot;update_check&quot;: &quot;data\/lastupdatecheck.txt&quot;,
  342. &quot;raintpl_tmp&quot;: &quot;tmp\/&quot;,
  343. &quot;raintpl_tpl&quot;: &quot;tpl\/&quot;,
  344. &quot;thumbnails_cache&quot;: &quot;cache&quot;,
  345. &quot;page_cache&quot;: &quot;pagecache&quot;
  346. },
  347. &quot;general&quot;: {
  348. &quot;check_updates&quot;: true,
  349. &quot;rss_permalinks&quot;: true,
  350. &quot;links_per_page&quot;: 20,
  351. &quot;default_private_links&quot;: true,
  352. &quot;enable_thumbnails&quot;: true,
  353. &quot;enable_localcache&quot;: true,
  354. &quot;check_updates_branch&quot;: &quot;stable&quot;,
  355. &quot;check_updates_interval&quot;: 86400,
  356. &quot;enabled_plugins&quot;: [
  357. &quot;markdown&quot;,
  358. &quot;wallabag&quot;,
  359. &quot;archiveorg&quot;
  360. ],
  361. &quot;timezone&quot;: &quot;Europe\/Paris&quot;,
  362. &quot;title&quot;: &quot;My Shaarli&quot;,
  363. &quot;header_link&quot;: &quot;?&quot;
  364. },
  365. &quot;extras&quot;: {
  366. &quot;show_atom&quot;: false,
  367. &quot;hide_public_links&quot;: false,
  368. &quot;hide_timestamps&quot;: false,
  369. &quot;open_shaarli&quot;: false,
  370. &quot;redirector&quot;: &quot;http://anonym.to/?&quot;,
  371. &quot;redirector_encode_url&quot;: false
  372. },
  373. &quot;general&quot;: {
  374. &quot;header_link&quot;: &quot;?&quot;,
  375. &quot;links_per_page&quot;: 20,
  376. &quot;enabled_plugins&quot;: [
  377. &quot;markdown&quot;,
  378. &quot;wallabag&quot;
  379. ],
  380. &quot;timezone&quot;: &quot;Europe\/Paris&quot;,
  381. &quot;title&quot;: &quot;My Shaarli&quot;
  382. },
  383. &quot;updates&quot;: {
  384. &quot;check_updates&quot;: true,
  385. &quot;check_updates_branch&quot;: &quot;stable&quot;,
  386. &quot;check_updates_interval&quot;: 86400
  387. },
  388. &quot;feed&quot;: {
  389. &quot;rss_permalinks&quot;: true,
  390. &quot;show_atom&quot;: false
  391. },
  392. &quot;privacy&quot;: {
  393. &quot;default_private_links&quot;: true,
  394. &quot;hide_public_links&quot;: false,
  395. &quot;hide_timestamps&quot;: false
  396. },
  397. &quot;thumbnail&quot;: {
  398. &quot;enable_thumbnails&quot;: true,
  399. &quot;enable_localcache&quot;: true
  400. },
  401. &quot;redirector&quot;: {
  402. &quot;url&quot;: &quot;http://anonym.to/?&quot;,
  403. &quot;encode_url&quot;: false
  404. },
  405. &quot;plugins&quot;: {
  406. &quot;WALLABAG_URL&quot;: &quot;http://demo.wallabag.org&quot;,
  407. &quot;WALLABAG_VERSION&quot;: &quot;1&quot;
  408. }
  409. } ?&gt;
  410. </code></pre>
  411. <h2 id="additional-configuration">Additional configuration</h2>
  412. <p>The playvideos plugin may require that you adapt your server's
  413. <a href="https://github.com/shaarli/Shaarli/blob/master/plugins/playvideos/README.md#troubleshooting">Content Security Policy</a>
  414. configuration to work properly.<a href="../.html"></a></p>
  415. </div>
  416. </div>
  417. <footer>
  418. <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
  419. <a href="../Plugins/" class="btn btn-neutral float-right" title="Plugins">Next <span class="icon icon-circle-arrow-right"></span></a>
  420. <a href="../Server-security/" class="btn btn-neutral" title="Server security"><span class="icon icon-circle-arrow-left"></span> Previous</a>
  421. </div>
  422. <hr/>
  423. <div role="contentinfo">
  424. <!-- Copyright etc -->
  425. </div>
  426. Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
  427. </footer>
  428. </div>
  429. </div>
  430. </section>
  431. </div>
  432. <div class="rst-versions" role="note" style="cursor: pointer">
  433. <span class="rst-current-version" data-toggle="rst-current-version">
  434. <a href="https://github.com/shaarli/Shaarli" class="fa fa-github" style="float: left; color: #fcfcfc"> GitHub</a>
  435. <span><a href="../Server-security/" style="color: #fcfcfc;">&laquo; Previous</a></span>
  436. <span style="margin-left: 15px"><a href="../Plugins/" style="color: #fcfcfc">Next &raquo;</a></span>
  437. </span>
  438. </div>
  439. <script src="../js/theme.js"></script>
  440. </body>
  441. </html>