当前位置:   article > 正文

frp ini 文件配置、启动、 访问例子_frpc -c frpc.ini

frpc -c frpc.ini

frpc.ini 文件 写法 :

[common]
server_addr = xxx.xx.xxx.xxx
server_port = 7000
[web]
type = http
local_port = 9090
local_ip = 127.0.0.1
custom_domains = xxx.xx.xxx.xxx
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

注: xxx.xx.xxx.xxx 为公网ip地址
以上 2行和8行 xxx.xx.xxx.xxx 保持 一致

客户端运行命令 : frpc -c frpc.ini

frps.ini 文件写法

[common]
bind_port = 7000
vhost_http_port = 6001 
  • 1
  • 2
  • 3

服务端 运行 命令 ./frps -c frps.ini

其中 第三行 为 web 映射后的端口
外网访问 在浏览器地址 输入 :xxx.xx.xxx.xxx:6001
即可访问 内网的网站 127.0.0.1:9090

本地多个web端口映射外网配置方法
frps.ini

[common]
bind_port = 7000
vhost_http_port = 8011

dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin
[ssh]
listen_port = 6000
auth_token = 123456
[web1]
type = http
custom_domains = app1.abc.fun
auth_token = 123456
[web2]
type = http
custom_domains = app2.abc.fun
auth_token = 123456
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

app1.abc.fun 和 app2.abc.fun 是外网域名,需要配置域名解析服务器,在外网能过ping通

frpc.ini

[common]
server_addr = xx.xx.xx.xx
server_port = 7000
auth_token = 123456
vhost_http_port = 8011
[web01]
type = http
local_ip = 127.0.0.1
local_port = 9092
custom_domains = app1.abc.fun
[web02]
type = http
local_ip =  127.0.0.1
local_port = 9090
custom_domains = app2.abc.fun

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

xx.xx.xx.xx为 公网 ip

访问 web01时: app1.abc.fun:8011
访问 web02时: app2.abc.fun:8011

frps.ini 也可以这样写 不用配置 web01 web02

[common]
bind_port = 7000
vhost_http_port = 8011

dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin
[ssh]
listen_port = 6000
auth_token = 123456
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

第三中配置方案参照:

frps.ini

[common]
bind_port = 7000
vhost_http_port = 8011

subdomain_host = abc.com
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin
[ssh]
listen_port = 6000
auth_token = 123456
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

frpc.ini

[common]
server_addr = XX.XX.XX.XX
server_port = 7000
auth_token = 123456
vhost_http_port = 8011
[web01]
type = http
local_ip = 127.0.0.1
local_port = 8011
subdomain = app1
[web02]
type = http
local_ip =  127.0.0.1
local_port = 9090
subdomain = app2

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

以上6行 和 11行 名字不能一样,一样的话 只有11行配置生效,6行配置不生效。
访问web01 http://app1.abc.com:8011/
访问web02 http://app2.abc.com:8011/

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/607627
推荐阅读
  

闽ICP备14008679号