aboutsummaryrefslogtreecommitdiff
path: root/articles/2026/Installation-of-Snac2-on-Artix-Linux.html
blob: 2b752eaef41fde04d9952feb6b1e9457f0d6e515 (plain)
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
<!doctype html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/style.css">
    <link rel="icon" type="image/x-icon" href="/favicon.ico">
    <title>Installation of Snac2 on Artix Linux</title>
  </head>
  <body>
    <header>
      <h1>Bloggings</h1>
      <a href="/index.php">Back</a>
    </header>
    <main>
      <article>
<h2>Installation of Snac2 on Artix Linux</h2>
<h3>2026-05-20</h3>
<h4>Installation of snac2 on Artix Linux +Nginx +Dinit</h4>
<pre>
useradd -m -s /bin/bash snac
passwd snac
usermod -aG wheel snac
su - snac
mkdir src
cd src
git clone https://codeberg.org/grunfink/snac2.git
cd snac2
make
sudo make install
snac init ~/data
</pre>
<h3>snac init will ask these questions:</h2>
<pre>
Host name: your.server.domain
Path prefix: leave empty
Network address: 127.0.0.1
Port: 8001
</pre>
<h3>add user</h3>
<pre>
snac adduser ~/data
</pre>
<h3> In /home/snac/data/server.json edit these settings:</h3>
<pre>
admin_email
admin_account
title
short_description

and add this line:

"proxy_media: true
</pre>
<h3> As root, create the dinit script: /etc/dinit.d/snac2</h3>
<pre>
type = process
run-as = snac
command = /usr/local/bin/snac httpd /home/snac/data
depends-on = NetworkManager
restart = true
smooth-recovery = yes
log-type = file
logfile = /var/log/dinit/snac2.log
</pre>
<h3>enable snac2</h3>
<pre>
dinitcl enable snac2
</pre>
<h3>NGINX Media caching</h3>
<p>
see <a href="https://it-notes.dragas.net/2025/01/29/improving-snac-performance-with-nginx-proxy-cache/">it-notes.fragas.net</a>
</p>
<h3>Nginx configuration
<p>
see <a href="https://comam.es/snac-doc/snac.8.html">comam.es</a>.<br/> 
Use $host not $http_host (gixy)
</p>
<h3>in /etc/nginx/nginx.conf http section add:</h3>
<pre>
proxy_cache_path /var/cache/nginx/snac_cache levels=1:2 keys_zone=snac:10m max_size=1g inactive=1440m use_temp_path=off;
</pre>
<h3>make cache folder</h3>
<pre>
mkdir -p /var/cache/nginx/snac_cache
</pre>
<h3>/etc/nginx/sites-available/example.com</h3>
<pre>
server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name example.com;

    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/example.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;
    # openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
    ssl_dhparam /etc/ssl/certs/dhparam.pem;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

location / {
    proxy_pass http://127.0.0.1:8001;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $remote_addr;
}

location ~ ^/.+/s/ {
    proxy_cache snac;
    proxy_pass http://127.0.0.1:8001;
    proxy_set_header Host $host;
    proxy_cache_valid 200 1d;
    proxy_cache_valid 404 1h;
    proxy_ignore_headers "Cache-Control" "Expires";
    proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
    proxy_cache_lock on;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header X-Proxy-Cache $upstream_cache_status;
}
}

server {
    listen 80;
    listen [::]:80;
    server_name example.com;
    return 301 https://$host$request_uri;
}
</pre>

<h3>add pleroma relay</h3>
<p>see <a href="https://relaylist.com/">relaylist.com</a></p>
<pre>
su - snac
snac adduser ~/data relay
snac follow ~/data relay https://relay.toot.io/actor
</pre>
      </article>
    </main>
    <footer>
      <p>§</p>
    </footer>
  </body>
</html>