]> git.immae.eu Git - github/shaarli/Shaarli.git/blob - doc/Shaarli-configuration.md
d0560d793edf5b43879b9035f82a72d2e44eefd5
[github/shaarli/Shaarli.git] / doc / Shaarli-configuration.md
1 #Shaarli configuration
2 ## Foreword
3
4 **Do not edit configuration options in index.php! Your changes would be lost.**
5
6 Once your Shaarli instance is installed, the file `data/config.php` is generated:
7 * it contains all settings, and can be edited to customize values
8 * it defines which [plugins](Plugin-System) are enabled[](.html)
9 * its values override those defined in `index.php`
10
11 ## File and directory permissions
12 The server process running Shaarli must have:
13 - `read` access to the following resources:
14 - PHP scripts: `index.php`, `application/*.php`, `plugins/*.php`
15 - 3rd party PHP and Javascript libraries: `inc/*.php`, `inc/*.js`
16 - static assets:
17 - CSS stylesheets: `inc/*.css`
18 - `images/*`
19 - RainTPL templates: `tpl/*.html`
20 - `read`, `write` and `execution` access to the following directories:
21 - `cache` - thumbnail cache
22 - `data` - link data store, configuration options
23 - `pagecache` - Atom/RSS feed cache
24 - `tmp` - RainTPL page cache
25
26 On a Linux distribution:
27 - the web server user will likely be `www` or `http` (for Apache2)
28 - it will be a member of a group of the same name: `www:www`, `http:http`
29 - to give it access to Shaarli, either:
30 - unzip Shaarli in the default web server location (usually `/var/www/`) and set the web server user as the owner
31 - put users in the same group as the web server, and set the appropriate access rights
32 - if you have a domain / subdomain to serve Shaarli, [configure the server](Server-configuration) accordingly[](.html)
33
34 ## Example `data/config.php`
35 See also [Plugin System](Plugin-System.html).
36
37 ```php
38 <?php
39 // User login
40 $GLOBALS['login'] = '<login>';[](.html)
41
42 // User password hash
43 $GLOBALS['hash'] = '200c452da46c2f889e5e48c49ef044bcacdcb095';[](.html)
44
45 // Password salt
46 $GLOBALS['salt'] = '13b654102321576033d8473b63a275a1bf94c0f0'; [](.html)
47
48 // Local timezone
49 $GLOBALS['timezone'] = 'Africa/Abidjan';[](.html)
50 date_default_timezone_set('Africa/Abidjan');
51
52 // Shaarli title
53 $GLOBALS['title'] = 'My Little Shaarly';[](.html)
54
55 // Link the Shaarli title points to
56 $GLOBALS['titleLink'] = '?';[](.html)
57
58 // HTTP referer redirector
59 $GLOBALS['redirector'] = '';[](.html)
60
61 // Disable session hijacking
62 $GLOBALS['disablesessionprotection'] = false; [](.html)
63
64 // Whether new links are private by default
65 $GLOBALS['privateLinkByDefault'] = false;[](.html)
66
67 // Enabled plugins
68 // Note: each plugin may provide further settings through its own "config.php"
69 $GLOBALS['config'['ENABLED_PLUGINS'] = array('addlink_toolbar', 'qrcode');]('ENABLED_PLUGINS']-=-array('addlink_toolbar',-'qrcode');.html)
70
71 // Subdirectory where Shaarli stores its data files.
72 // You can change it for better security.
73 $GLOBALS['config'['DATADIR'] = 'data';]('DATADIR']-=-'data';.html)
74
75 // File used to store settings
76 $GLOBALS['config'['CONFIG_FILE'] = 'data/config.php';]('CONFIG_FILE']-=-'data/config.php';.html)
77
78 // File containing the link database
79 $GLOBALS['config'['DATASTORE'] = 'data/datastore.php';]('DATASTORE']-=-'data/datastore.php';.html)
80
81 // Number of links displayed per page
82 $GLOBALS['config'['LINKS_PER_PAGE'] = 20;]('LINKS_PER_PAGE']-=-20;.html)
83
84 // File recording failed login attempts and IP bans
85 $GLOBALS['config'['IPBANS_FILENAME'] = 'data/ipbans.php';]('IPBANS_FILENAME']-=-'data/ipbans.php';.html)
86
87 // Failed login attempts before being banned
88 $GLOBALS['config'['BAN_AFTER'] = 4;]('BAN_AFTER']-=-4;.html)
89
90 // Duration of an IP ban, in seconds (30 minutes)
91 $GLOBALS['config'['BAN_DURATION'] = 1800;]('BAN_DURATION']-=-1800;.html)
92
93 // If set to true, everyone will be able to add, edit and remove links,
94 // as well as change configuration
95 $GLOBALS['config'['OPEN_SHAARLI'] = false;]('OPEN_SHAARLI']-=-false;.html)
96
97 // Do not show link timestamps
98 $GLOBALS['config'['HIDE_TIMESTAMPS'] = false;]('HIDE_TIMESTAMPS']-=-false;.html)
99
100 // Set to false to disable local thumbnail cache, e.g. due to limited disk quotas
101 $GLOBALS['config'['ENABLE_THUMBNAILS'] = true;]('ENABLE_THUMBNAILS']-=-true;.html)
102
103 // Thumbnail cache directory
104 $GLOBALS['config'['CACHEDIR'] = 'cache';]('CACHEDIR']-=-'cache';.html)
105
106 // Enable feed (rss, atom, dailyrss) cache
107 $GLOBALS['config'['ENABLE_LOCALCACHE'] = true;]('ENABLE_LOCALCACHE']-=-true;.html)
108
109 // Feed cache directory
110 $GLOBALS['config'['PAGECACHE'] = 'pagecache';]('PAGECACHE']-=-'pagecache';.html)
111
112 // RainTPL cache directory (keep the trailing slash!)
113 $GLOBALS['config'['RAINTPL_TMP'] = 'tmp/';]('RAINTPL_TMP']-=-'tmp/';.html)
114
115 // RainTPL template directory (keep the trailing slash!)
116 $GLOBALS['config'['RAINTPL_TPL'] = 'tpl/';]('RAINTPL_TPL']-=-'tpl/';.html)
117
118 // Whether Shaarli checks for new releases at https://github.com/shaarli/Shaarli
119 $GLOBALS['config'['ENABLE_UPDATECHECK'] = true;]('ENABLE_UPDATECHECK']-=-true;.html)
120
121 // File to store the latest Shaarli version
122 $GLOBALS['config'['UPDATECHECK_FILENAME'] = 'data/lastupdatecheck.txt';]('UPDATECHECK_FILENAME']-=-'data/lastupdatecheck.txt';.html)
123
124 // Delay between version checks (requires to be logged in) (24 hours)
125 $GLOBALS['config'['UPDATECHECK_INTERVAL'] = 86400;]('UPDATECHECK_INTERVAL']-=-86400;.html)
126
127 // For each link, display a link to an archived version on archive.org
128 $GLOBALS['config'['ARCHIVE_ORG'] = false;]('ARCHIVE_ORG']-=-false;.html)
129
130 // The RSS item links point:
131 // true => directly to the link
132 // false => to the entry on Shaarli (permalink)
133 $GLOBALS['config'['ENABLE_RSS_PERMALINKS'] = true;]('ENABLE_RSS_PERMALINKS']-=-true;.html)
134
135 // Hide all links to non-logged users
136 $GLOBALS['config'['HIDE_PUBLIC_LINKS'] = false;]('HIDE_PUBLIC_LINKS']-=-false;.html)
137
138 $GLOBALS['config'['PUBSUBHUB_URL'] = '';]('PUBSUBHUB_URL']-=-'';.html)
139
140 // Show an ATOM Feed button next to the Subscribe (RSS) button.
141 // ATOM feeds are available at the address ?do=atom regardless of this option.
142 $GLOBALS['config'['SHOW_ATOM'] = false;]('SHOW_ATOM']-=-false;.html)
143
144 // Set this to true if the redirector requires encoded URL, false otherwise.
145 $GLOBALS['config'['REDIRECTOR_URLENCODE'] = true;]('REDIRECTOR_URLENCODE']-=-true;.html)
146 ?>
147 ```
148
149 ## Additional configuration
150
151 The playvideos plugin may require that you adapt your server's [Content Security Policy](https://github.com/shaarli/Shaarli/blob/master/plugins/playvideos/README.md#troubleshooting) configuration to work properly.[](.html)