apt-get update
apt-get upgrade
apt-get install git wget software-properties-common python-software-properties
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).
- https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04
- https://tecadmin.net/install-php-7-on-ubuntu/
- https://www.colinodell.com/blog/2016-12/installing-php-7-1
- oerdnj/deb.sury.org#56 (if
add-apt-repository
doesn't work)
apt-get install nodejs
apt-get install 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/api.example.com/current/public;
server_name api.example.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /links/.+\.mp3$ {
types {
application/octet-stream;
}
}
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
- https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-14-04-lts
- https://mediatemple.net/community/products/developer/204405534/install-nginx-on-ubuntu
Install composer and move it to /usr/local/bin
.
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
- https://getcomposer.org/doc/00-intro.md
- https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-14-04
Set password and you can skip other sections.
adduser datmusic
Docs: https://linux.die.net/man/8/adduser
Login as datmusic (su datmusic
).
Run following commands in home folder of datmusic
user, one by one (update domain names):
cd /home/datmusic
mkdir api.example.com
git clone https://github.com/alashow/datmusic-api.git
mv datmusic-api/storage api.example.com/
cp datmusic-api/.env.example api.example.com/.env
cd api.example.com
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/api.example.com/
wget https://gist.githubusercontent.com/alashow/c1a7be2020059e4ae8160328fbaf1a8c/raw/update.sh -O update.sh
chmod +x update.sh
Edit update.sh
(vim update.sh
)
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 update.sh
.
Now run update.sh
./update.sh
Update.sh script should work correctly, if it doesn't, please open issue at https://github.com/alashow/datmusic-api/issues or leave comment here.
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/api.example.com
wget https://gist.githubusercontent.com/alashow/c1a7be2020059e4ae8160328fbaf1a8c/raw/fix_permissions.sh -O - | sh