Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux 客户端食用指南 #208

Open
theseann opened this issue Aug 26, 2019 · 8 comments
Open

Linux 客户端食用指南 #208

theseann opened this issue Aug 26, 2019 · 8 comments
Labels
pinned Something is important

Comments

@theseann
Copy link

theseann commented Aug 26, 2019

前提

服务端已经配置完毕,支持http、https

两种方法:

  1. 直接用此工具监听Server的80和443
  2. 通过nginx监听80和443,然后进行反代 相关进阶配置说明

因为我服务器上有多个站点,所以选择了后者

nginx 配置文件

server {
        listen 80;
        server_name music.163.com interface.music.163.com;

        location / {
                proxy_pass http://127.0.0.1:1630;
                proxy_set_header HOST 'music.163.com';
        }
}
server {
        listen 443 ssl;
        server_name music.163.com interface.music.163.com;

        ssl on;
        ssl_certificate /etc/nginx/ssl/163/server.crt;
        ssl_certificate_key /etc/nginx/ssl/163/server.key;

        ssl_session_timeout 10m;
        ssl_session_cache shared:SSL:10m;

        ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'AES128+EECDH:AES128+EDH';
        ssl_prefer_server_ciphers on;

        location / {
                proxy_pass https://127.0.0.1:1631;
                proxy_set_header HOST 'music.163.com';
        }
}

环境介绍

  • ubuntu 1804 LTS
  • netease-cloud-music 1.2.1

1.证书

目前除 UWP 外其它客户端均优先请求 HTTPS 接口,默认配置下本代理对网易云所有 HTTPS API 连接返回空数据,促使客户端降级使用 HTTP 接口 (新版 Linux 客户端和 macOS 客户端已无法降级)

自签证书请参考 #48

为ubuntu 添加信任证书

lushan@u:~/Downloads$ sudo cp ca.crt /usr/local/share/ca-certificates/
[sudo] password for lushan: 
lushan@u:~/Downloads$ sudo update-ca-certificates 
Updating certificates in /etc/ssl/certs...
1 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

Adding debian:ca.pem
done.
done.

2.修改hosts

sudo vim /etc/hosts
<Your-Server-IP> music.163.com
<Your-Server-IP> interface.music.163.com

增加默认启动参数

Linux 客户端 (1.2 版本以上需要自签证书 MITM,启动客户端需要增加 --ignore-certificate-errors 参数)

lushan@u:/usr/share/applications$ ls | grep netease
netease-cloud-music.desktop
lushan@u:/usr/share/applications$ sudo vim netease-cloud-music.desktop 

在Exec这一行末尾增加--ignore-certificate-errors 参数

image

效果

image

Tips

服务端可以使用 pm2-dev来进行 调试,或pm2保持进程的持久化运行

image

@nondanee nondanee added the pinned Something is important label Aug 27, 2019
@nondanee
Copy link
Owner

补充一下,也可以用代理模式的

我印象中在 sudo su 下,使用 export http_proxy=, export https_proxy= 会有效果

如果是系统设置的 network 里设代理,不用 sudo 也能用

@nondanee nondanee changed the title linux 客户端食用指南 Linux 客户端食用指南 Aug 29, 2019
@theseann
Copy link
Author

export http_proxy=, export https_proxy=

应该是只能用于终端代理

  1. 直接在终端中运行,只会在当前终端有效。
  2. 添加到你使用的shell解释器的配置文件中,例如.bashrc,.zshrc等,对所有使用该shell解释器的终端有效

我没试过,有试过的朋友可以说一下是否可行

@nondanee
Copy link
Owner

@lushann
啊我试了下现在我的网易云在 sudo 下都启动不了 😂
之前用过,是可以的,但仅限 su 权限下

不过说实话确实改 hosts 更方便一点 👍

@EroSagiri
Copy link

linux直接设置系统代理也可以

@nondanee
Copy link
Owner

nondanee commented Feb 1, 2020

@EromangaMe
嗯也可以的 (改 hosts 对其他的影响小一点,比如浏览器默认会走系统代理)

@Guwalgiyakuan
Copy link

感谢指南,幸亏搜到了这个 issue 终于本机也吃上了。

@tnnevol
Copy link

tnnevol commented Apr 18, 2020

首先感谢楼主教程,本人deepin 客户端版本 1.2.0,按照教程走完发现 nginx代理返回500,解决方案:在命令后 加上-f <music.163.com ip>(一定要在修改hosts之前获取)
主:1、deepin 1.2.0 歌曲无法听,请退出登录。可能客户端无法带上token
2、1.2.0不需要添加ca证书。

@xx668888
Copy link

打包好的 unblockneteasemusic-linux 这个怎么运行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pinned Something is important
Projects
None yet
Development

No branches or pull requests

6 participants