Install app dependencies
apt install nginx php8.2-{common,fpm,gd,mysql} zlib1g
Download the latest PrivateBin source file and export the downloaded archive
wget https://github.com/PrivateBin/PrivateBin/archive/refs/tags/1.7.8.tar.gz -O privatebin.tar.gz && \
tar -zxf privatebin.tar.gz && \
rm privatebin.tar.gz
Move the contents of the export to /var/www/privatebin/public
mkdir /var/www/privatebin && \
mv PrivateBin* /var/www/privatebin/public
To better secure the installation, move/separate the bin/ cfg/ lib/ tpl/ vendor/
directories one directory back into the /var/www/privatebin/
directory.
mv bin/ cfg/ lib/ tpl/ vendor/ ../
Modify index.php
to tell PrivateBin that its assets are now outside of the webroot, one directory back.
sed -i "s|define('PATH', '');|define('PATH', '../');|" /var/www/privatebin/public/index.php
Change ownership
chown www-data:www-data -R /var/www/privatebin/
Install the following vhost config
bash -c "cat > /etc/nginx/sites-available/privatebin.conf"<<'EOF'
server {
listen 80;
server_name paste.example.com;
root /var/www/privatebin/public;
index index.php;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
}
}
EOF
Disable the default site, enable the new site, restart
rm /etc/nginx/sites-enabled/default && \
ln -s /etc/nginx/sites-available/privatebin.conf /etc/nginx/sites-enabled/privatebin.conf && \
systemctl restart nginx.service