]> git.immae.eu Git - github/shaarli/Shaarli.git/blob - doc/Shaarli-configuration.html
Merge pull request #294 from virtualtam/doc/update
[github/shaarli/Shaarli.git] / doc / Shaarli-configuration.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <meta name="generator" content="pandoc">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
7 <title>Shaarli - Shaarli configuration</title>
8 <style type="text/css">code{white-space: pre;}</style>
9 <!--[if lt IE 9]>
10 <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
11 <![endif]-->
12 <style type="text/css">
13 table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
14 margin: 0; padding: 0; vertical-align: baseline; border: none; }
15 table.sourceCode { width: 100%; line-height: 100%; }
16 td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
17 td.sourceCode { padding-left: 5px; }
18 code > span.kw { color: #007020; font-weight: bold; }
19 code > span.dt { color: #902000; }
20 code > span.dv { color: #40a070; }
21 code > span.bn { color: #40a070; }
22 code > span.fl { color: #40a070; }
23 code > span.ch { color: #4070a0; }
24 code > span.st { color: #4070a0; }
25 code > span.co { color: #60a0b0; font-style: italic; }
26 code > span.ot { color: #007020; }
27 code > span.al { color: #ff0000; font-weight: bold; }
28 code > span.fu { color: #06287e; }
29 code > span.er { color: #ff0000; font-weight: bold; }
30 </style>
31 <link rel="stylesheet" href="github-markdown.css">
32 </head>
33 <body>
34 <div id="local-sidebar">
35 <ul>
36 <li><a href="Home.html">Home</a></li>
37 <li>Installation
38 <ul>
39 <li><a href="Server-requirements.html">Server requirements</a></li>
40 <li><a href="Server-configuration.html">Server configuration</a></li>
41 <li><a href="Shaarli-configuration.html">Shaarli configuration</a></li>
42 </ul></li>
43 <li><a href="Usage.html">Usage</a>
44 <ul>
45 <li><a href="Sharing-button.html">Sharing button</a> (bookmarklet)</li>
46 <li><a href="Firefox-share.html">Firefox share</a></li>
47 <li><a href="RSS-feeds.html">RSS feeds</a></li>
48 </ul></li>
49 <li>How To
50 <ul>
51 <li><a href="Backup,-restore,-import-and-export.html">Backup, restore, import and export</a></li>
52 <li><a href="Copy-an-existing-installation-over-SSH-and-serve-it-locally.html">Copy an existing installation over SSH and serve it locally</a></li>
53 <li><a href="Download-CSS-styles-from-an-OPML-list.html">Download CSS styles from an OPML list</a></li>
54 </ul></li>
55 <li><a href="Troubleshooting.html">Troubleshooting</a></li>
56 <li><a href="Development.html">Development</a>
57 <ul>
58 <li><a href="GnuPG-signature.html">GnuPG signature</a></li>
59 <li><a href="Coding-guidelines.html">Coding guidelines</a></li>
60 <li><a href="Directory-structure.html">Directory structure</a></li>
61 <li><a href="3rd-party-libraries.html">3rd party libraries</a></li>
62 <li><a href="Plugin-System.html">Plugin System</a></li>
63 <li><a href="Security.html">Security</a></li>
64 <li><a href="Static-analysis.html">Static analysis</a></li>
65 <li><a href="Theming.html">Theming</a></li>
66 <li><a href="Unit-tests.html">Unit tests</a></li>
67 </ul></li>
68 <li>About
69 <ul>
70 <li><a href="FAQ.html">FAQ</a></li>
71 <li><a href="Community-&amp;-Related-software.html">Community &amp; Related software</a></li>
72 <li><a href="TODO.html">TODO</a></li>
73 </ul></li>
74 </ul>
75 </div>
76 <h1 id="shaarli-configuration">Shaarli configuration</h1>
77 <h2 id="foreword">Foreword</h2>
78 <p><strong>Do not edit configuration options in index.php! Your changes would be lost.</strong></p>
79 <p>Once your Shaarli instance is installed, the file <code>data/config.php</code> is generated:</p>
80 <ul>
81 <li>it contains all settings, and can be edited to customize values</li>
82 <li>its values override those defined in <code>index.php</code></li>
83 </ul>
84 <h2 id="file-and-directory-permissions">File and directory permissions</h2>
85 <p>The server process running Shaarli must have:</p>
86 <ul>
87 <li><code>read</code> access to the following resources:
88 <ul>
89 <li>PHP scripts: <code>index.php</code>, <code>application/*.php</code></li>
90 <li>3rd party PHP and Javascript libraries: <code>inc/*.php</code>, <code>inc\*.js</code></li>
91 <li>static assets:
92 <ul>
93 <li>CSS stylesheets: <code>inc\*.css</code></li>
94 <li><code>images\*</code></li>
95 </ul></li>
96 <li>RainTPL templates: <code>tpl\*.html</code></li>
97 </ul></li>
98 <li><code>read</code>, <code>write</code> and <code>execution</code> access to the following directories:
99 <ul>
100 <li><code>cache</code> - thumbnail cache</li>
101 <li><code>data</code> - link data store, configuration options</li>
102 <li><code>pagecache</code> - Atom/RSS feed cache</li>
103 <li><code>tmp</code> - RainTPL page cache</li>
104 </ul></li>
105 </ul>
106 <p>On a Linux distribution:</p>
107 <ul>
108 <li>the web server user will likely be <code>www</code> or <code>http</code> (for Apache2)</li>
109 <li>it will be a member of a group of the same name: <code>www:www</code>, <code>http:http</code></li>
110 <li>to give it access to Shaarli, either:
111 <ul>
112 <li>unzip Shaarli in the default web server location (usually <code>/var/www/</code>) and set the web server user as the owner</li>
113 <li>put users in the same group as the web server, and set the appropriate access rights</li>
114 </ul></li>
115 <li>if you have a domain / subdomain to serve Shaarli, <a href="Server-configuration">configure the server</a> accordingly<a href=".html"></a></li>
116 </ul>
117 <h2 id="example-dataconfig.php">Example <code>data/config.php</code></h2>
118 <pre class="sourceCode php"><code class="sourceCode php"><span class="kw">&lt;?php</span>
119 <span class="co">// User login</span>
120 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;login&#39;</span><span class="ot">]</span> = <span class="st">&#39;&lt;login&gt;&#39;</span><span class="ot">;[](</span>.html<span class="ot">)</span>
121
122 <span class="co">// User password hash</span>
123 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;hash&#39;</span><span class="ot">]</span> = <span class="st">&#39;200c452da46c2f889e5e48c49ef044bcacdcb095&#39;</span><span class="ot">;[](</span>.html<span class="ot">)</span>
124
125 <span class="co">// Password salt</span>
126 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;salt&#39;</span><span class="ot">]</span> = <span class="st">&#39;13b654102321576033d8473b63a275a1bf94c0f0&#39;</span><span class="ot">;</span> <span class="ot">[](</span>.html<span class="ot">)</span>
127
128 <span class="co">// Local timezone</span>
129 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;timezone&#39;</span><span class="ot">]</span> = <span class="st">&#39;Africa/Abidjan&#39;</span><span class="ot">;[](</span>.html<span class="ot">)</span>
130 <span class="fu">date_default_timezone_set</span><span class="ot">(</span><span class="st">&#39;Africa/Abidjan&#39;</span><span class="ot">);</span>
131
132 <span class="co">// Shaarli title</span>
133 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;title&#39;</span><span class="ot">]</span> = <span class="st">&#39;My Little Shaarly&#39;</span><span class="ot">;[](</span>.html<span class="ot">)</span>
134
135 <span class="co">// Link the Shaarli title points to</span>
136 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;titleLink&#39;</span><span class="ot">]</span> = <span class="st">&#39;?&#39;</span><span class="ot">;[](</span>.html<span class="ot">)</span>
137
138 <span class="co">// HTTP referer redirector</span>
139 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;redirector&#39;</span><span class="ot">]</span> = <span class="st">&#39;&#39;</span><span class="ot">;[](</span>.html<span class="ot">)</span>
140
141 <span class="co">// Disable session hijacking</span>
142 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;disablesessionprotection&#39;</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;</span> <span class="ot">[](</span>.html<span class="ot">)</span>
143
144 <span class="co">// Whether new links are private by default</span>
145 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;privateLinkByDefault&#39;</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;[](</span>.html<span class="ot">)</span>
146
147 <span class="co">// Subdirectory where Shaarli stores its data files.</span>
148 <span class="co">// You can change it for better security.</span>
149 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;DATADIR&#39;</span><span class="ot">]</span> = <span class="st">&#39;data&#39;</span><span class="ot">;](</span><span class="st">&#39;DATADIR&#39;</span><span class="ot">]</span>-=-<span class="st">&#39;data&#39;</span><span class="ot">;</span>.html<span class="ot">)</span>
150
151 <span class="co">// File used to store settings</span>
152 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;CONFIG_FILE&#39;</span><span class="ot">]</span> = <span class="st">&#39;data/config.php&#39;</span><span class="ot">;](</span><span class="st">&#39;CONFIG_FILE&#39;</span><span class="ot">]</span>-=-<span class="st">&#39;data/config.php&#39;</span><span class="ot">;</span>.html<span class="ot">)</span>
153
154 <span class="co">// File containing the link database</span>
155 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;DATASTORE&#39;</span><span class="ot">]</span> = <span class="st">&#39;data/datastore.php&#39;</span><span class="ot">;](</span><span class="st">&#39;DATASTORE&#39;</span><span class="ot">]</span>-=-<span class="st">&#39;data/datastore.php&#39;</span><span class="ot">;</span>.html<span class="ot">)</span>
156
157 <span class="co">// Number of links displayed per page</span>
158 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;LINKS_PER_PAGE&#39;</span><span class="ot">]</span> = <span class="dv">20</span><span class="ot">;](</span><span class="st">&#39;LINKS_PER_PAGE&#39;</span><span class="ot">]</span>-=-<span class="dv">20</span><span class="ot">;</span>.html<span class="ot">)</span>
159
160 <span class="co">// File recording failed login attempts and IP bans</span>
161 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;IPBANS_FILENAME&#39;</span><span class="ot">]</span> = <span class="st">&#39;data/ipbans.php&#39;</span><span class="ot">;](</span><span class="st">&#39;IPBANS_FILENAME&#39;</span><span class="ot">]</span>-=-<span class="st">&#39;data/ipbans.php&#39;</span><span class="ot">;</span>.html<span class="ot">)</span>
162
163 <span class="co">// Failed login attempts before being banned</span>
164 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;BAN_AFTER&#39;</span><span class="ot">]</span> = <span class="dv">4</span><span class="ot">;](</span><span class="st">&#39;BAN_AFTER&#39;</span><span class="ot">]</span>-=-<span class="dv">4</span><span class="ot">;</span>.html<span class="ot">)</span>
165
166 <span class="co">// Duration of an IP ban, in seconds (30 minutes)</span>
167 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;BAN_DURATION&#39;</span><span class="ot">]</span> = <span class="dv">1800</span><span class="ot">;](</span><span class="st">&#39;BAN_DURATION&#39;</span><span class="ot">]</span>-=-<span class="dv">1800</span><span class="ot">;</span>.html<span class="ot">)</span>
168
169 <span class="co">// If set to true, everyone will be able to add, edit and remove links,</span>
170 <span class="co">// as well as change configuration</span>
171 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;OPEN_SHAARLI&#39;</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;](</span><span class="st">&#39;OPEN_SHAARLI&#39;</span><span class="ot">]</span>-=-<span class="kw">false</span><span class="ot">;</span>.html<span class="ot">)</span>
172
173 <span class="co">// Do not show link timestamps</span>
174 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;HIDE_TIMESTAMPS&#39;</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;](</span><span class="st">&#39;HIDE_TIMESTAMPS&#39;</span><span class="ot">]</span>-=-<span class="kw">false</span><span class="ot">;</span>.html<span class="ot">)</span>
175
176 <span class="co">// Set to false to disable local thumbnail cache, e.g. due to limited disk quotas</span>
177 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;ENABLE_THUMBNAILS&#39;</span><span class="ot">]</span> = <span class="kw">true</span><span class="ot">;](</span><span class="st">&#39;ENABLE_THUMBNAILS&#39;</span><span class="ot">]</span>-=-<span class="kw">true</span><span class="ot">;</span>.html<span class="ot">)</span>
178
179 <span class="co">// Thumbnail cache directory</span>
180 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;CACHEDIR&#39;</span><span class="ot">]</span> = <span class="st">&#39;cache&#39;</span><span class="ot">;](</span><span class="st">&#39;CACHEDIR&#39;</span><span class="ot">]</span>-=-<span class="st">&#39;cache&#39;</span><span class="ot">;</span>.html<span class="ot">)</span>
181
182 <span class="co">// Enable feed (rss, atom, dailyrss) cache</span>
183 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;ENABLE_LOCALCACHE&#39;</span><span class="ot">]</span> = <span class="kw">true</span><span class="ot">;](</span><span class="st">&#39;ENABLE_LOCALCACHE&#39;</span><span class="ot">]</span>-=-<span class="kw">true</span><span class="ot">;</span>.html<span class="ot">)</span>
184
185 <span class="co">// Feed cache directory</span>
186 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;PAGECACHE&#39;</span><span class="ot">]</span> = <span class="st">&#39;pagecache&#39;</span><span class="ot">;](</span><span class="st">&#39;PAGECACHE&#39;</span><span class="ot">]</span>-=-<span class="st">&#39;pagecache&#39;</span><span class="ot">;</span>.html<span class="ot">)</span>
187
188 <span class="co">// RainTPL cache directory (keep the trailing slash!)</span>
189 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;RAINTPL_TMP&#39;</span><span class="ot">]</span> = <span class="st">&#39;tmp/&#39;</span><span class="ot">;](</span><span class="st">&#39;RAINTPL_TMP&#39;</span><span class="ot">]</span>-=-<span class="st">&#39;tmp/&#39;</span><span class="ot">;</span>.html<span class="ot">)</span>
190
191 <span class="co">// RainTPL template directory (keep the trailing slash!)</span>
192 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;RAINTPL_TPL&#39;</span><span class="ot">]</span> = <span class="st">&#39;tpl/&#39;</span><span class="ot">;](</span><span class="st">&#39;RAINTPL_TPL&#39;</span><span class="ot">]</span>-=-<span class="st">&#39;tpl/&#39;</span><span class="ot">;</span>.html<span class="ot">)</span>
193
194 <span class="co">// Whether Shaarli checks for new releases at https://github.com/shaarli/Shaarli</span>
195 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;ENABLE_UPDATECHECK&#39;</span><span class="ot">]</span> = <span class="kw">true</span><span class="ot">;](</span><span class="st">&#39;ENABLE_UPDATECHECK&#39;</span><span class="ot">]</span>-=-<span class="kw">true</span><span class="ot">;</span>.html<span class="ot">)</span>
196
197 <span class="co">// File to store the latest Shaarli version</span>
198 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;UPDATECHECK_FILENAME&#39;</span><span class="ot">]</span> = <span class="st">&#39;data/lastupdatecheck.txt&#39;</span><span class="ot">;](</span><span class="st">&#39;UPDATECHECK_FILENAME&#39;</span><span class="ot">]</span>-=-<span class="st">&#39;data/lastupdatecheck.txt&#39;</span><span class="ot">;</span>.html<span class="ot">)</span>
199
200 <span class="co">// Delay between version checks (requires to be logged in) (24 hours)</span>
201 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;UPDATECHECK_INTERVAL&#39;</span><span class="ot">]</span> = <span class="dv">86400</span><span class="ot">;](</span><span class="st">&#39;UPDATECHECK_INTERVAL&#39;</span><span class="ot">]</span>-=-<span class="dv">86400</span><span class="ot">;</span>.html<span class="ot">)</span>
202
203 <span class="co">// For each link, display a link to an archived version on archive.org</span>
204 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;ARCHIVE_ORG&#39;</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;](</span><span class="st">&#39;ARCHIVE_ORG&#39;</span><span class="ot">]</span>-=-<span class="kw">false</span><span class="ot">;</span>.html<span class="ot">)</span>
205
206 <span class="co">// The RSS item links point:</span>
207 <span class="co">// true =&gt; directly to the link</span>
208 <span class="co">// false =&gt; to the entry on Shaarli (permalink)</span>
209 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;ENABLE_RSS_PERMALINKS&#39;</span><span class="ot">]</span> = <span class="kw">true</span><span class="ot">;](</span><span class="st">&#39;ENABLE_RSS_PERMALINKS&#39;</span><span class="ot">]</span>-=-<span class="kw">true</span><span class="ot">;</span>.html<span class="ot">)</span>
210
211 <span class="co">// Hide all links to non-logged users</span>
212 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;HIDE_PUBLIC_LINKS&#39;</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;](</span><span class="st">&#39;HIDE_PUBLIC_LINKS&#39;</span><span class="ot">]</span>-=-<span class="kw">false</span><span class="ot">;</span>.html<span class="ot">)</span>
213
214 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;PUBSUBHUB_URL&#39;</span><span class="ot">]</span> = <span class="st">&#39;&#39;</span><span class="ot">;](</span><span class="st">&#39;PUBSUBHUB_URL&#39;</span><span class="ot">]</span>-=-<span class="st">&#39;&#39;</span><span class="ot">;</span>.html<span class="ot">)</span>
215
216 <span class="co">// Show an ATOM Feed button next to the Subscribe (RSS) button.</span>
217 <span class="co">// ATOM feeds are available at the address ?do=atom regardless of this option.</span>
218 <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;config&#39;</span><span class="ot">[</span><span class="st">&#39;SHOW_ATOM&#39;</span><span class="ot">]</span> = <span class="kw">false</span><span class="ot">;](</span><span class="st">&#39;SHOW_ATOM&#39;</span><span class="ot">]</span>-=-<span class="kw">false</span><span class="ot">;</span>.html<span class="ot">)</span>
219 <span class="kw">?&gt;</span></code></pre>
220 </body>
221 </html>