返回博客

CentOS Frp 配置教程

CentOS Frp 服务器端和客户端配置教程,包括一键配置脚本和详细的 frpc 配置文件示例,以及 Nginx 反向代理配置。

Mt.r
|

服务器端

一键配置,方便 https://github.com/MvsCode/frps-onekey

客户端

看文档配置即可

https://gofrp.org/docs/examples/vhost-http/

[common]
server_addr = xx.xx.xx.xx(外网 ip)
server_port = 7000

[web]
type = http
local_ip = (内网服务器 ip)
# 转发到 nginx 监听的端口
local_port = 80
custom_domains = xx.xx.xx.xx(外网 ip,和 server_addr 的相同)

nginx 配置

server {
  listen       80;
  server_name  localhost;

  location / {
      root   html;
      index  index.html index.htm;
  }
  location ^~ /xxx(解析的路径){
      proxy_pass http://xxx.xxx.xx.xx/xxx(转发的内网地址);
      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_redirect off;
  }