配置Nginx反向代理FRPS服务端口

配置Nginx反向代理FRPS服务端口

文章作用

根据最后的效果图,我们可以看到省去了端口号访问,直接用域名访问内网中的项目,方便好记!

Nginx简介

  1. 开放源代码的高性能HTTP服务器和反向代理服务器,同时支持IMAP和POP3代理

  2. 高性能、高可用、丰富的功能模块,低资源占用

  3. 高达50000个并发连接

FRP简介

  1. frp 是一个可用于内网穿透的高性能反向代理应用,支持 tcp, udp, http, https 协议.
  2. frp为免费且开源项目,需要自己利用一台拥有公网IP机器搭建服务端,以部署内网穿透项目。
  3. GITHUB开源项目地址

安装Nginx

采用源码安装

安装目录: /usr/local/nginx

wget http://nginx.org/download/nginx-1.14.0.tar.gz

tar -xzf nginx-1.14.0.tar.gz -C /usr/src/

yum -y install gcc pcre pcre-devel openssl \
> openssl-devel gd gd-devel perl perl-ExtUtils-Embed

./configure --prefix=/usr/local/nginx --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_perl_module --with-mail \
> --with-mail_ssl_module

make && make install 


启动脚本指令

/usr/local/nginx/sbin/nginx #启动主程序
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf #配置文件启动主程序
/usr/local/nginx/sbin/nginx -s stop #关闭主程序
/usr/local/nginx/sbin/nginx -s reload #关闭主程序

配置反向代理

Nginx配置文件

    #FRP测试
    server {
       listen 80;
       server_name **.***.***; # 填写你的域名
       location / {
           proxy_pass http://127.0.0.1:8088; # 填写frps的http端口
           proxy_redirect http://$host/ http://$http_host/;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header Host $host;
       }
    }

frpc的ini配置文件


[web01]
type = http
local_ip = 127.0.0.1
local_port = 1024 #填写本机的服务端口
use_encryption = false
use_compression = true
custom_domains = **.***.*** #填写你的域名

frps的ini配置文件

#subdomain_host = **.***.***

效果图

配置Nginx反向代理frps端口pic1

参考引用

frps服务端与nginx可共用80端口

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值