
部署一个简约的在线音乐播放器
AI-摘要
Kizai GPT
AI初始化中...
介绍自己
生成本文简介
推荐相关文章
前往主页
前往tianli博客
在 NAS 部署NeteaseCloudMusicApi 服务
https://github.com/Binaryify/NeteaseCloudMusicApi
创建目录专门存放这些服务:
mkdir -p /opt/repo && cd /opt/repo
-克隆项目:
git clone git@github.com:Binaryify/NeteaseCloudMusicApi.git
cd NeteaseCloudMusicApi
npm install
创建 systemdctl 服务:vim /etc/systemd/system/NeteaseCloudMusicApi.service
添加以下内容:
[Unit]
Description=NeteaseCloudMusicApi
[Service]
WorkingDirectory=/opt/repo/NeteaseCloudMusicApi
ExecStart=/usr/local/bin/node app.js
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
服务控制相关命令:
systemctl start NeteaseCloudMusicApi.service
systemctl status NeteaseCloudMusicApi.service
systemctl stop NeteaseCloudMusicApi.service
systemctl restart NeteaseCloudMusicApi.service
systemctl enable NeteaseCloudMusicApi.service
systemctl disable NeteaseCloudMusicApi.service
部署 UNM-Server
克隆项目:
git clone git@github.com:imsyy/UNM-Server.git
cd UNM-Server
// 安装依赖
pnpm install
// 运行
pnpm start
创建 systemdctl 服务:vim /etc/systemd/system/UNM-Server.service
添加以下内容:
[Unit]
Description=UNM-Server
[Service]
WorkingDirectory=/opt/repo/UNM-Server
ExecStart=/usr/local/bin/pnpm start
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target
服务控制相关命令:
systemctl start UNM-Server.service
systemctl status UNM-Server.service
systemctl stop UNM-Server.service
systemctl restart UNM-Server.service
systemctl enable UNM-Server.service
systemctl disable UNM-Server.service
部署 SPlayer 服务
同样在/opt/repo
文件目录克隆项目
git clone git@github.com:imsyy/SPlayer.git
修改环境变量:
vim .env
# 修改里面的API地址,修改为:http://localhost:3000/
安装依赖
pnpm install
# 或者
yarn install
# 或者
npm install
开发
pnpm dev
# 或者
yarn dev
# 或者
npm dev
构建
pnpm build
# 或者
yarn build
# 或者
npm build
如果遇到打包不了的情况可以安装:npm install -g pnpm
使用Nginx 部署 dist 页面:
在这个路径下:/etc/nginx/sites-enabled
创建一个配置文件:splayer
server {
listen 1163;
server_name _;
root /opt/repo/SPlayer/dist;
index index.html;
gzip on;
gzip_min_length 1k;
gzip_comp_level 3;
gzip_types text/xml text/plain text/css application/javascript application/x-javascript application/rss+xml text/javascript image/tiff image/svg+xml application/json application/xml;
gzip_vary on;
location ~assets/ {
expires max;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
使用 nginx -t
查看配置文件是否有误
使用 nginx -s reload
来更新服务
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 Kizai
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果