开通fnid后,通过系统分配的域名(XXX.5ddd.com)访问时是无法打开迅雷的,只能通过ip直连的方式访问,大概率是因为域名只解析80和443端口。
但是无意间发现系统自带nginx,这机会不就来了吗!
主要思路是添加前置url路径,把迅雷从80端口转发到将2345,这种思路有些投机取巧,只适用于应用内部所有请求都有前置url的情况,比如1panel内部就是用了很多端口直接访问的接口,所以无法通过nginx配置。
原理讲完,下面的步骤都是常规nginx配置方法,考虑到飞牛系统的易用性,可能一些非计算机行业的朋友会一头雾水,所以每一步写的细一些,老司机不妨自行下车。
1、#查看nginx位置
ps -ef|grep nginx
- root 1368 1 0 Oct25 ? 00:00:00 nginx: master process /usr/trim/nginx/sbin/nginx
- root 2734 2646 0 Oct25 ? 00:00:00 s6-supervise svc-nginx
- root 2877 2734 0 Oct25 ? 00:00:00 nginx: master process /usr/sbin/nginx -g daemon off;
2、进入到目录
cd /usr/trim/nginx/sbin
3、查询nginx配置文件位置
./nginx -t
- nginx: the configuration file /usr/trim/nginx/conf/nginx.conf syntax is ok
- nginx: configuration file /usr/trim/nginx/conf/nginx.conf test is successful
4、修改配置文件
vim /usr/trim/nginx/conf/nginx.conf
添加#迅雷这一段代码,保存退出
- ......
- index index.html index.htm;
- error page 404 /index.html;
-
- #迅雷
- location /xl {
- proxy pass http://127.0.0.1:2345/;
- }
- location /webman {
- proxy pass http://127.0.0.1:2345/webman;
- }
-
- # websocket配置
- location /websocket {
- ......
5、重新加载配置文件
./nginx -s reload
6、测试
此时从桌面直接打开迅雷会发现还是无法访问,因为默认的访问方式是 XXX.5ddd.com:2345 访问的,只需将端口号改成刚才配置的xl前置路径访问即可:XXX.5ddd.com/xl