frp+nginx 内网穿透,超详细

1: nginx我之前博客有安装教程,(外网服务器)。 2:frp下载安装包 ,解压就行,解压后包括frp服务端和客户端,服务端frps(放外网服务器上),客户端frpc(放内网服务器上) 

硬件配置:
1:外网服务器linux,windows都行
2:内网服务器,你项目运行的服务器

1:nginx配置文件nginx.conf

events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name www.yizhaocy.com; location ^~ /scm_server_web/ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:8080; } } }  

2:frp服务器frps, 放在(装外网服务器),配置文件修改 frps.ini

[common]  bind_port = 7001  vhost_http_port = 8080   subdomain_host = www.yizhaocy.com  token = 111111   dashboard_addr = 0.0.0.0  dashboard_port = 7501  dashboard_user = admin dashboard_pwd = admin  log_level = info  log_max_days = 999  heartbeat_timeout = 90  max_pool_count = 5  

frps服务启动命令

nohup ./frps -c frps.ini >/dev/null 2>&1 &

frp客户端frpc文件(内网)配置文件修改 frpc.ini

[common]  server_addr = www.yizhaocy.com  server_port = 7001  token = 111111  admin_addr = 127.0.0.1 admin_port = 7401 admin_user = admin admin_pwd = admin log_file = ./frpc.log log_level = info   [www.yizhaocy.com]  type = http   local_ip = 127.0.0.1  local_port = 8666  custom_domains = www.yizhaocy.com 

我在这用的是http的方式
启动命令

nohup ./frpc -c ./frpc.ini >/dev/null 2>&1 &

frp重启

关闭frp
1:查看进程
ps -aux|grep frp| grep -v grep
2:关闭进程
kill -9 1111

nginx重启

./nginx -s reload

原文链接:https://blog.csdn.net/qq_26856361/article/details/115750661

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享