aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/Shaarli-configuration.md
blob: d0560d793edf5b43879b9035f82a72d2e44eefd5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#Shaarli configuration
## Foreword

**Do not edit configuration options in index.php! Your changes would be lost.** 

Once your Shaarli instance is installed, the file `data/config.php` is generated:
* it contains all settings, and can be edited to customize values
* it defines which [plugins](Plugin-System) are enabled[](.html)
* its values override those defined in `index.php`

## File and directory permissions
The server process running Shaarli must have:
- `read` access to the following resources:
    - PHP scripts: `index.php`, `application/*.php`, `plugins/*.php`
    - 3rd party PHP and Javascript libraries: `inc/*.php`, `inc/*.js`
    - static assets:
        - CSS stylesheets: `inc/*.css`
        - `images/*`
    - RainTPL templates: `tpl/*.html`
- `read`, `write` and `execution` access to the following directories:
    - `cache` - thumbnail cache
    - `data` - link data store, configuration options
    - `pagecache` - Atom/RSS feed cache
    - `tmp` - RainTPL page cache

On a Linux distribution:
- the web server user will likely be `www` or `http` (for Apache2)
- it will be a member of a group of the same name: `www:www`, `http:http`
- to give it access to Shaarli, either:
    - unzip Shaarli in the default web server location (usually `/var/www/`) and set the web server user as the owner
    - put users in the same group as the web server, and set the appropriate access rights
- if you have a domain / subdomain to serve Shaarli, [configure the server](Server-configuration) accordingly[](.html)

## Example `data/config.php`
See also [Plugin System](Plugin-System.html).

```php
<?php 
// User login
$GLOBALS['login'] = '<login>';[](.html)

// User password hash
$GLOBALS['hash'] = '200c452da46c2f889e5e48c49ef044bcacdcb095';[](.html)

// Password salt
$GLOBALS['salt'] = '13b654102321576033d8473b63a275a1bf94c0f0'; [](.html)

// Local timezone
$GLOBALS['timezone'] = 'Africa/Abidjan';[](.html)
date_default_timezone_set('Africa/Abidjan');

// Shaarli title
$GLOBALS['title'] = 'My Little Shaarly';[](.html)

// Link the Shaarli title points to
$GLOBALS['titleLink'] = '?';[](.html)

// HTTP referer redirector
$GLOBALS['redirector'] = '';[](.html)

// Disable session hijacking
$GLOBALS['disablesessionprotection'] = false; [](.html)

// Whether new links are private by default
$GLOBALS['privateLinkByDefault'] = false;[](.html)

// Enabled plugins
// Note: each plugin may provide further settings through its own "config.php"
$GLOBALS['config'['ENABLED_PLUGINS'] = array('addlink_toolbar', 'qrcode');]('ENABLED_PLUGINS']-=-array('addlink_toolbar',-'qrcode');.html)

// Subdirectory where Shaarli stores its data files.
// You can change it for better security.
$GLOBALS['config'['DATADIR'] = 'data';]('DATADIR']-=-'data';.html)

// File used to store settings
$GLOBALS['config'['CONFIG_FILE'] = 'data/config.php';]('CONFIG_FILE']-=-'data/config.php';.html)

// File containing the link database
$GLOBALS['config'['DATASTORE'] = 'data/datastore.php';]('DATASTORE']-=-'data/datastore.php';.html)

// Number of links displayed per page
$GLOBALS['config'['LINKS_PER_PAGE'] = 20;]('LINKS_PER_PAGE']-=-20;.html)

// File recording failed login attempts and IP bans
$GLOBALS['config'['IPBANS_FILENAME'] = 'data/ipbans.php';]('IPBANS_FILENAME']-=-'data/ipbans.php';.html)

// Failed login attempts before being banned
$GLOBALS['config'['BAN_AFTER'] = 4;]('BAN_AFTER']-=-4;.html)

// Duration of an IP ban, in seconds (30 minutes)
$GLOBALS['config'['BAN_DURATION'] = 1800;]('BAN_DURATION']-=-1800;.html)

// If set to true, everyone will be able to add, edit and remove links,
// as well as change configuration
$GLOBALS['config'['OPEN_SHAARLI'] = false;]('OPEN_SHAARLI']-=-false;.html)

// Do not show link timestamps
$GLOBALS['config'['HIDE_TIMESTAMPS'] = false;]('HIDE_TIMESTAMPS']-=-false;.html)

// Set to false to disable local thumbnail cache, e.g. due to limited disk quotas
$GLOBALS['config'['ENABLE_THUMBNAILS'] = true;]('ENABLE_THUMBNAILS']-=-true;.html)

// Thumbnail cache directory
$GLOBALS['config'['CACHEDIR'] = 'cache';]('CACHEDIR']-=-'cache';.html)

// Enable feed (rss, atom, dailyrss) cache
$GLOBALS['config'['ENABLE_LOCALCACHE'] = true;]('ENABLE_LOCALCACHE']-=-true;.html)

// Feed cache directory
$GLOBALS['config'['PAGECACHE'] = 'pagecache';]('PAGECACHE']-=-'pagecache';.html)

// RainTPL cache directory (keep the trailing slash!)
$GLOBALS['config'['RAINTPL_TMP'] = 'tmp/';]('RAINTPL_TMP']-=-'tmp/';.html)

// RainTPL template directory (keep the trailing slash!)
$GLOBALS['config'['RAINTPL_TPL'] = 'tpl/';]('RAINTPL_TPL']-=-'tpl/';.html)

// Whether Shaarli checks for new releases at https://github.com/shaarli/Shaarli
$GLOBALS['config'['ENABLE_UPDATECHECK'] = true;]('ENABLE_UPDATECHECK']-=-true;.html)

// File to store the latest Shaarli version
$GLOBALS['config'['UPDATECHECK_FILENAME'] = 'data/lastupdatecheck.txt';]('UPDATECHECK_FILENAME']-=-'data/lastupdatecheck.txt';.html)

// Delay between version checks (requires to be logged in) (24 hours)
$GLOBALS['config'['UPDATECHECK_INTERVAL'] = 86400;]('UPDATECHECK_INTERVAL']-=-86400;.html)

// For each link, display a link to an archived version on archive.org
$GLOBALS['config'['ARCHIVE_ORG'] = false;]('ARCHIVE_ORG']-=-false;.html)

// The RSS item links point:
// true   =>  directly to the link
// false  =>  to the entry on Shaarli (permalink)
$GLOBALS['config'['ENABLE_RSS_PERMALINKS'] = true;]('ENABLE_RSS_PERMALINKS']-=-true;.html)

// Hide all links to non-logged users
$GLOBALS['config'['HIDE_PUBLIC_LINKS'] = false;]('HIDE_PUBLIC_LINKS']-=-false;.html)

$GLOBALS['config'['PUBSUBHUB_URL'] = '';]('PUBSUBHUB_URL']-=-'';.html)

// Show an ATOM Feed button next to the Subscribe (RSS) button.
// ATOM feeds are available at the address ?do=atom regardless of this option.
$GLOBALS['config'['SHOW_ATOM'] = false;]('SHOW_ATOM']-=-false;.html)

// Set this to true if the redirector requires encoded URL, false otherwise.
$GLOBALS['config'['REDIRECTOR_URLENCODE'] = true;]('REDIRECTOR_URLENCODE']-=-true;.html)
?>
```

## Additional configuration

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)