Trail of Explore🚲.

frp内网穿透服务搭建

Word count: 262Reading time: 1 min
2023/05/18

场景:需要外网访问内网的jellyfin服务器

1
2
3
4
windows linux 分别下载以下文件
https://github.com/fatedier/frp/releases/download/v0.48.0/frp_0.48.0_windows_amd64.zip

https://github.com/fatedier/frp/releases/download/v0.48.0/frp_0.48.0_linux_amd64.tar.gz

解压后有以下文件
image.png

家庭内的主机修改frpc.ini 配置文件,启动frpc.exe
公网服务器修改frps.ini配置文件,启动frps服务

frpc.ini

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[common]
server_addr = *.*.*.191
server_port = 7000

[app1]
type = http
local_port = 5001
subdomain = appjellyfin

[app2]
type = http
local_port = 8082
subdomain = app2

[app3]
type = http
local_port = 8083
subdomain = app3

frps.ini

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[common]
bind_addr = 0.0.0.0
bind_port = 7000
vhost_http_port = 8080
subdomain_host = bev0129so.*

[app1]
type = http
subdomain = appjellyfin
[app2]
type = http
subdomain = app2
[app3]
type = http
subdomain = app3

由于有多个内网服务,需要多个三级域名,配合nginx反向代理服务
nginx 配置如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
server {
listen 80;
server_name app.*;
location / {
client_max_body_size 1000m;
#frps 8080
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
}

分别启动
./frps -c frps.ini
./frpc -c frpc.ini

5001端口的appjellyfin为一个文档服务作为测试
image.png

启动日志
服务端
image.png

客户端
image.png

通了 😎
image.png

补一个正式部署Jellyfin的图
image.png

image.png

CATALOG