Skip to content

Commit 7984aa3

Browse files
authored
docs(wiki): add manual install instructions for PERSISTENT_TOKENS_KEY
1 parent fed969d commit 7984aa3

1 file changed

Lines changed: 89 additions & 3 deletions

File tree

docs/wiki/install setup.md

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Bind `/var/www/uploads` to a **dedicated folder** (not the root of a massive sha
6464

6565
- PHP **8.3+**
6666
- Web server (Apache / Nginx / Caddy + PHP-FPM)
67-
- PHP extensions: `json`, `curl`, `zip`, and standard defaults
67+
- PHP extensions: `json`, `curl`, `zip`, `openssl`, and standard defaults
6868
- No database required
6969

7070
### Recommended layout (default paths)
@@ -130,6 +130,92 @@ sudo chown -R www-data:www-data /var/www/sessions
130130
sudo chmod 700 /var/www/sessions
131131
```
132132

133+
### Set `PERSISTENT_TOKENS_KEY` for manual installs (required)
134+
135+
FileRise reads the persistent tokens encryption key from the `PERSISTENT_TOKENS_KEY` environment variable. On manual installs, you must set this yourself so "remember me" tokens are not encrypted with the default fallback key.
136+
137+
Generate a strong key:
138+
139+
```bash
140+
openssl rand -base64 32
141+
```
142+
143+
Example output:
144+
145+
```text
146+
m2A6L0x3WnRjYzN6cVhYV3Q2dHhXc0xkQ0V0Q0VjU0RvWm5Qd1E9
147+
```
148+
149+
Use that generated value in one of the setups below.
150+
151+
#### Apache
152+
153+
If you run FileRise through Apache with PHP as an Apache module, set the environment variable in the vhost:
154+
155+
```apache
156+
<VirtualHost *:80>
157+
ServerName example.com
158+
DocumentRoot /var/www/filerise/public
159+
160+
SetEnv PERSISTENT_TOKENS_KEY "paste_your_generated_key_here"
161+
</VirtualHost>
162+
```
163+
164+
Then reload Apache:
165+
166+
```bash
167+
sudo systemctl reload apache2
168+
```
169+
170+
#### Nginx + PHP-FPM
171+
172+
For PHP-FPM, set the environment variable in the pool config:
173+
174+
```ini
175+
; /etc/php/8.3/fpm/pool.d/www.conf
176+
clear_env = no
177+
env[PERSISTENT_TOKENS_KEY] = paste_your_generated_key_here
178+
```
179+
180+
Then restart PHP-FPM and reload Nginx:
181+
182+
```bash
183+
sudo systemctl restart php8.3-fpm
184+
sudo systemctl reload nginx
185+
```
186+
187+
#### systemd override for PHP-FPM (optional alternative)
188+
189+
If you prefer, you can set it at the service level instead of inside the pool file:
190+
191+
```bash
192+
sudo systemctl edit php8.3-fpm
193+
```
194+
195+
Add:
196+
197+
```ini
198+
[Service]
199+
Environment="PERSISTENT_TOKENS_KEY=paste_your_generated_key_here"
200+
```
201+
202+
Then restart PHP-FPM:
203+
204+
```bash
205+
sudo systemctl daemon-reload
206+
sudo systemctl restart php8.3-fpm
207+
```
208+
209+
#### Caddy + PHP-FPM
210+
211+
Caddy typically passes requests to PHP-FPM, so set the variable in PHP-FPM using one of the methods above.
212+
213+
### Important note about changing the key later
214+
215+
Set your `PERSISTENT_TOKENS_KEY` **before users start using remember-me tokens** and keep it stable.
216+
217+
If you change this key later, previously issued persistent login tokens can no longer be decrypted, so users with remembered sessions will need to log in again.
218+
133219
### Proxy / subpath notes
134220

135221
- Set `FR_PUBLISHED_URL` to the public URL (e.g. `https://example.com/files`).
@@ -142,15 +228,15 @@ Uploaded file data and app metadata must go through the API. Do **not** expose `
142228

143229
Apache:
144230

145-
```
231+
```apache
146232
<LocationMatch "^/(uploads|users|metadata)(?:/|$)">
147233
Require all denied
148234
</LocationMatch>
149235
```
150236

151237
Nginx:
152238

153-
```
239+
```nginx
154240
location ~* ^/(uploads|users|metadata)(/|$) {
155241
return 403;
156242
}

0 commit comments

Comments
 (0)