Comments (17)
不用加端口的话就要用到 nginx 了,找一下nginx 的 安装方法,(各个操作系统都不太一样,按照好后配置的文件目录可能也不一样),然后可以在本地先加上配置,把对应的网址host 改成 127.0.0.1.,就可以了,比如下面的这个配置,然后把 test.163.jsososo.com 的 host 绑定到 127.0.0.1,然后启动或重启 nignx (nginx
/ nginx -s reload
),你再访问 test.163.jsososo.com 就跟你访问 ip + 端口一样了。至于下载json 文件的,可能是浏览器识别返回的请求内容问题,浏览器把他当作文件处理了。
server {
listen 80;
server_name test.163.jsososo.com;
location / {
proxy_pass http://127.0.0.1:3300/;
proxy_set_header Host "163.jsososo.com";
}
}
from qqmusicapi.
需要配置好node环境,npm install
安装好相关依赖,npm start
才是启动后台,如果是服务器的话最好用 pm2 去启动,可以做守护进程,如果需要通过域名访问接口,还要安装配置好 nginx
from qqmusicapi.
我是小白 不怎么懂 可以给个配置方法不
from qqmusicapi.
emm,建议去搜一些从零开始部署 nodejs 服务的教程吧,不同系统的服务器一些具体操作也不太一样,而且这个一时半会儿也讲不太清楚,主要需要的就是 node环境、pm2 和 nginx
from qqmusicapi.
那第一次弄要弄多久呢
from qqmusicapi.
emm,主要还是看人,看你对这些的熟悉程度,建议你可以在自己的电脑上先搭一下,了解一下这个流程,然后再到服务器上试一下,如果都比较陌生,可能还是需要一两天的时间去摸索一下,多搜搜看看别人的教程吧
from qqmusicapi.
我不会呀 要不你还是教教我吧
from qqmusicapi.
额,如果自己真的一点都不会,那我觉得也没有必要一定去搭一个这样的后台吧。具体关于部署的一些东西,属于运维方向的问题,其实我自己也不是特别懂,基本也是遇到什么问题就查什么,你可以先在自己电脑上安装node,然后git clone 项目后,在目录下 npm install,npm start,然后访问 localhost:3300
,先走一遍这个流程
from qqmusicapi.
我在本地做 成功了 谢谢你
怎么不用加端口号就可以解析呢
还有我每次请求他就给我下载一个JSON文件
from qqmusicapi.
本地请求不会下载JSON文件 局域网请求浏览器会下载json文件
from qqmusicapi.
那段配置加到本地的哪里呢?
from qqmusicapi.
mac 下默认是 /usr/local/etc/nginx/nginx.conf
,其他系统的可能要去查一下
from qqmusicapi.
nginx: [emerg] "server" directive is not allowed here in C:\phpstudy_pro\Extensions\Nginx1.15.11/conf/nginx.conf:1
报错了
from qqmusicapi.
额。不要全都替换掉,
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name 127.0.0.1;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
include servers/*;
# 粘贴的内容
}
格式应该是这样的
from qqmusicapi.
弄好了 谢谢!
from qqmusicapi.
VPS不是网页后台 (也就是通过127.0.0.1无法访问网站) 那安装nginx可以配置吗?
from qqmusicapi.
如果能通过 ip + 端口访问到就能用 nginx 配的,把 127.0.0.1 改成服务器的外网 ip 就行
from qqmusicapi.
Related Issues (20)
- 这些是不是都不能用了 HOT 7
- search接口 系统异常:Request failed with status code 404 HOT 1
- 公用 cookie 的形式指的是/user/setCookie吗
- 评论接口返回400怎么回事,原本是没问题的 HOT 1
- 运行时报错The string to be decoded is not correctly encoded.
- 可以试试QQ音乐客户端扫码登录呢? HOT 3
- user/refresh接口有别的接口替代的吗
- ✅cookie长期有效方案,已解决 HOT 10
- 请求没有歌词的歌曲的歌词导致崩溃 HOT 3
- 黑白名单是什么啊,有什么学习资料推荐嘛
- 黑白名单是什么啊,有什么系统的学习资料吗
- 调用获取歌单详情去获取百万收藏官方歌单,无法获取数据
- 获取歌词时,没有获取到会崩溃
- [功能请求] 对ipv6的支持
- 怎样用后台程序设置cookie?只有在第一次服务端没cookie时可以生效。第二次再设置就不会生效了? HOT 1
- 无版权歌曲在 app 上可以正常播放,但是不支持分享,而 web 端打开显示无版权无法播放
- 数据统计模块报错
- 网址提示502
- 腾讯调整了接口吗,[获取专辑信息]和[歌手介绍]获取不到数据,上周还能正常调 HOT 8
- 发送评论和删除评论的接口无效
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qqmusicapi.