Deploy OLAINDEX

Install PHP-7.4

1
2
3
4
apt update
apt upgrade -y
apt install php-7.4 -y
apt install php7.4-{sqlite3,fpm,xml,curl,zip,mbstring,bcmath,redis} -y

Uninstall Apache2

1
2
apt remove apache2 -y
apt autoremove -y

Install Composer

1
2
3
4
5
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer

Install Caddy

1
2
3
4
5
apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | apt-key add -
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
apt update
apt install caddy

Install OLAINDEX

1
2
3
4
5
6
7
8
9
10
mkdir od
cd od
git clone https://github.com/WangNingkai/OLAINDEX.git tmp
mv tmp/.git .
rm -rf tmp
git reset --hard
composer install -vvv
chmod -R 777 /root/od/storage
chown -R www-data:www-data /root/od
composer run install-app

Use Caddy

1
2
3
vim /etc/caddy/Caddyfile
service caddy restart
service caddy status

Sample:

1
2
3
4
5
yourdomin.com {
root * /root/od/public
file_server
php_fastcgi unix//var/run/php/php7.4-fpm.sock
}

Finish

Funny!

Reference

OLAINDEX: https://olaindex.js.org

Caddy: https://caddyserver.com

Composer: https://getcomposer.org