frp笔记

官网文档

frp下载地址

mac 下载 darwin_amd64.tar.gz 后缀的,linux amd 64 位的下载 linux_amd64.tar.gz 后缀的

服务器运行脚本

./frps -c ./frps.ini 

配置文件

[common]
bindPort = 7000 #客户端链接服务器的端口
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = 123456
vhost_http_port = 1212;#服务器对外的http端口,比如80 443

[web]
listen_port=7777  #支持直接端口访问http

客户端运行脚本

./frpc -c ./frpc.toml

客户端配置文件

serverAddr = "101.37.xx.xx" #服务器ip
serverPort = 7000

[[proxies]]
name = "test-tcp"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = 6000

[[proxies]]
name = "web"
type = "http"
localIP = "127.0.0.1"
customDomains = ["服务器域名"]
localPort = 1212  #本地代理端口

[[proxies]]
name = "gz_web"
type = "tcp"
localIP="127.0.0.1"
localPort = 80
remotePort=7777 #直接端口访问http

服务器nginx配置

server {
    listen 80;
    listen [::]:80;
    server_name xxx.xxxsyscloud.com;
    location /test_yl { #微信公众号配置5个域名不够用了,测试环境加个后缀充当下
        proxy_pass http://xxx.xxxsyscloud.com:1212;
    }

}

客户端nginx配置

server {
    listen 1212;
    listen [::]:1212;
    server_name cloud.example.com;
    root /var/www//project/public;
    index index.html index.php;
    charset utf-8;
    location /test_yl {
        alias /var/www/project/public;
        index  index.html index.htm index.php;

        try_files $uri $uri/ /index.php?$query_string;

        if (!-e $request_filename){
            rewrite  ^/test_yl/(.*)$  /test_yl/index.php?s=$1  last;
        }
       location ~ \.php(.*)$ {
            fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            include fastcgi_params;
        }

    }
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    location ~ \.php$ {
       root /var/www//WITMED_1_2_x/public;
       fastcgi_pass  unix:/var/run/php/php7.4-fpm.sock;
       fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
       include fastcgi_params;
    }
}

supervisor 配置

[program:frp]
command = /home/itc/frp/frps -c /home/itc/frp/frps.toml
autostart=true
[program:frp]
command = /home/itc/frp/frpc -c /home/itc/frp/frpc.toml
autostart=true
本作品采用《CC 协议》,转载必须注明作者和本文链接
杭州PHP有好工作求推荐
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!