Dynamic Notes with Perlite
Dynamic Notes with Perlite
How to set up Perlite for Obsidian
Perlite is a web interface for the note taking app Obsidian. It’s a selfhosted alternative for their cloud vault. I wanted to set it up to allow my classmates to see my notes, and also to check them on computers that aren’t my own.
Install the Dependancies
1
sudo apt install nginx php php-fpm php-yaml cron git zip python3-certbot-nginx certbot apache2-utils
Install Perlite
1
2
3
4
sudo mkdir /srv
wget https://github.com/secure-77/Perlite/releases/download/1.6/Perlite_1.6.zip #or your version of perlite
unzip Perlite_1.6.zip
mv perlite/* /srv/perlite/
Create your Nginx Config
This will be located at /etc/nginx/sites-available/docs.jaspertech.pro
The config file:
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
server {
server_name docs.jaspertech.pro;
root /srv/perlite/;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# make sure this path is for your correct php version
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location ~* ^/(.*)/.obsidian/appearance.json$ {
allow all;
}
location ~* ^/(.*)/.obsidian/(.*)/theme.css$ {
allow all;
}
#added for this specific setup, thanks sec77!
location ~* ^/.obsidian/(.*)/theme.css$ {
allow all;
}
location ~ \.(git|github|obsidian|trash) {
deny all;
}
location ~ \.(md|json)$ {
deny all;
}
}
Then you can activate the site by creating a symlink to /etc/nginx/sites-enabled/
1
ln -s /etc/nginx/sites-available/docs.jaspertech.pro /etc/nginx/sites-enabled/
Create a DNS Record to the Server
A Record:
docs -> 11.22.33.44
Request a Certificate on the Server
1
sudo certbot --nginx -d docs.jaspertech.pro
Set up Nginx Authentication for Perlite
1
2
sudo mkdir -p /etc/nginx/auth/
sudo htpasswd -c /etc/nginx/auth/default.htpasswd nothing
Edit the Perlite Config
Located at /srv/perlite/settings.php
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
<?php
/*!
* Perlite v1.6 (https://github.com/secure-77/Perlite)
* Author: sec77 (https://secure77.de)
* Licensed under MIT (https://github.com/secure-77/Perlite/blob/main/LICENSE)
*/
$rootDir = "Notes";
$hideFolders = "Private,Essays,Readings";
$hiddenFileAccess = false;
$relPathes = false;
$uriPath = "/";
$siteTitle = "Public Notes";
$siteType = "article";
$siteImage = "";
$siteURL = "https://docs.jaspertech.pro";
$siteLogo = ""; // empty for no logo/customSection
$siteDescription = "Notes about random stuff";
$siteName = "Public Notes";
$siteHomepage = ""; // empty for $siteURL
$siteGithub = "https://github.com/Soulsender"; // empty for no Github
$siteTwitter = "";
$tempPath = ""; // blanc so it gets it automatically
$lineBreaks = true;
$allowedFileLinkTypes = ['pdf', 'mp4'];
$disablePopHovers = "false";
$showTOC = "true";
$showLocalGraph = "true";
$index = "README";
$font_size = "15";
$htmlSafeMode = true;
?>
Your Notes
Your obsidian vault goes at the root of /srv/perlite/. I wanted it to automatically update so I created a cronjob to git pull every 5 minutes.
1
*/5 * * * * cd /srv/perlite/Notes && /usr/bin/git pull
Enable & Start Nginx
1
2
3
4
5
6
7
8
# stop apache to prevent conflicts
sudo systemctl disable apache2 --now
# kill orphan instances if needed
sudo pkill -f nginx & wait $!
# start nginx
sudo systemctl enable nginx --now
This post is licensed under
CC BY 4.0
by the author.