Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Server suggestions

Install some dependencies

apt-get update
apt-get upgrade 
apt-get install git wget software-properties-common python-software-properties

Install PHP 7.1 and dependencies

add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.1 php7.1-fpm php7.1-cli php7.1-mcrypt php7.1-mbstring php7.1-zip php7.1-curl php7.1-dom


Use nano or other text editors if you don't know vim.

vim /etc/php/7.1/fpm/php.ini

Find #cgi.fix_pathinfo=1 line and update it to cgi.fix_pathinfo=0 (removing # will uncomment line).

Other tutorials:

Install nodejs

apt-get install nodejs

Other tutorials

Install Nginx

apt-get install nginx

Config nginx

vim /etc/nginx/sites-available/default

Remove all lines and add this (update with your domain name):

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    index index.php index.html index.htm;
    root /home/datmusic/;


    location / {
        try_files $uri $uri/ /index.php?$query_string;
    location ~ /links/.+\.mp3$ {
     types {

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

Now restart nginx (or reload):

service nginx restart

Other Tutorials

Install composer

Install composer and move it to /usr/local/bin.

curl -sS | php
mv composer.phar /usr/local/bin/composer

Other tutorials

Start installing datmusic-api

Add user

Set password and you can skip other sections.

adduser datmusic


Create main folders and files

Login as datmusic (su datmusic).

Run following commands in home folder of datmusic user, one by one (update domain names):

cd /home/datmusic
git clone
mv datmusic-api/storage
cp datmusic-api/.env.example
mkdir storage/app/cookies && mkdir -p storage/app/public/mp3
# Update .env for your needs (app_env, app_url, tokens)
vim .env


cd /home/datmusic/
wget -O
chmod +x

Edit (vim

You need to update ROOT_FOLDER to your domain or to another name (don't customize root folder if you didn't in sections above).

If you want to clone from custom repo, change repo url in

Now run

./ script should work correctly, if it doesn't, please open issue at or leave comment here.

Fix permissions

Login as root and run:

NOTE: if you aren't using datmusic username, then you will need downlload the script, change the username, and then run.

cd /home/datmusic/
wget -O - | sh
# run in "root" folder (e.g /home/datmusic/
chown -R datmusic:www-data storage .env
find storage -type f -exec chmod 664 {} \;
find storage -type d -exec chmod 775 {} \;
chgrp -R www-data storage .env
chmod -R ug+rwx storage .env
# update to your fork or another git repository
# main folder name, usually domain name
# timestamp as unique name for older releases
# if not first deployment (check whether "current" folder exists)
if [ -d "$FOLDER_NAME" ]; then
# move current release to releases folder
# clone repo to folder
git clone --depth=1 --branch=$REPO_BRANCH $REPO $FOLDER_NAME
# remove .git, we don't need it
rm -rf $FOLDER_NAME/.git
# remove default storage folder
rm -rf storage
# create symlink to storage folder and .env file
ln -s $ENV_PATH
# create symlink to mp3 folders
ln -s $STORAGE_PATH/app/public/mp3 public/mp3
ln -s $STORAGE_PATH/app/public/links public/links
composer install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment