1: nginx我之前博客有安装教程,(外网服务器)。 2:frp下载安装包 ,解压就行,解压后包括frp服务端和客户端,服务端frps(放外网服务器上),客户端frpc(放内网服务器上)1: nginx我之前博客有安装教程,(外网服务器)。 2:frp下载安装包 ,解压就行,解压后包括frp服务端和客户端,服务端frps(放外网服务器上),客户端frpc(放内网服务器上)1: nginx我之前博客有安装教程,(外网服务器)。 2:frp下载安装包 ,解压就行,解压后包括frp服务端和客户端,服务端frps(放外网服务器上),客户端frpc(放内网服务器上)
硬件配置:
1:外网服务器linux,windows都行
2:内网服务器,你项目运行的服务器
1:nginx配置文件nginx.conf
events <span class="token punctuation">{<!-- --></span> worker_connections 1024<span class="token punctuation">;</span> <span class="token punctuation">}</span> http <span class="token punctuation">{<!-- --></span> include mime<span class="token punctuation">.</span>types<span class="token punctuation">;</span> default_type application/octet-stream<span class="token punctuation">;</span> sendfile on<span class="token punctuation">;</span> keepalive_timeout 65<span class="token punctuation">;</span> server <span class="token punctuation">{<!-- --></span> listen 80<span class="token punctuation">;</span> server_name www<span class="token punctuation">.</span>yizhaocy<span class="token punctuation">.</span>com<span class="token punctuation">;</span> location ^~ <span class="token operator">/</span>scm_server_web/ <span class="token punctuation">{<!-- --></span> proxy_set_header X-Real-IP <span class="token variable">$remote_addr</span><span class="token punctuation">;</span> proxy_set_header Host <span class="token variable">$http_host</span><span class="token punctuation">;</span> proxy_pass http:<span class="token operator">/</span><span class="token operator">/</span>127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1:8080<span class="token punctuation">;</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span>events <span class="token punctuation">{<!-- --></span> worker_connections 1024<span class="token punctuation">;</span> <span class="token punctuation">}</span> http <span class="token punctuation">{<!-- --></span> include mime<span class="token punctuation">.</span>types<span class="token punctuation">;</span> default_type application/octet-stream<span class="token punctuation">;</span> sendfile on<span class="token punctuation">;</span> keepalive_timeout 65<span class="token punctuation">;</span> server <span class="token punctuation">{<!-- --></span> listen 80<span class="token punctuation">;</span> server_name www<span class="token punctuation">.</span>yizhaocy<span class="token punctuation">.</span>com<span class="token punctuation">;</span> location ^~ <span class="token operator">/</span>scm_server_web/ <span class="token punctuation">{<!-- --></span> proxy_set_header X-Real-IP <span class="token variable">$remote_addr</span><span class="token punctuation">;</span> proxy_set_header Host <span class="token variable">$http_host</span><span class="token punctuation">;</span> proxy_pass http:<span class="token operator">/</span><span class="token operator">/</span>127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1:8080<span class="token punctuation">;</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span>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
<span class="token namespace">[common]</span> bind_port = 7001 vhost_http_port = 8080 subdomain_host = www<span class="token punctuation">.</span>yizhaocy<span class="token punctuation">.</span>com token = 111111 dashboard_addr = 0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0 dashboard_port = 7501 dashboard_user = admin dashboard_pwd = admin log_level = info log_max_days = 999 heartbeat_timeout = 90 max_pool_count = 5<span class="token namespace">[common]</span> bind_port = 7001 vhost_http_port = 8080 subdomain_host = www<span class="token punctuation">.</span>yizhaocy<span class="token punctuation">.</span>com token = 111111 dashboard_addr = 0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0 dashboard_port = 7501 dashboard_user = admin dashboard_pwd = admin log_level = info log_max_days = 999 heartbeat_timeout = 90 max_pool_count = 5[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
<span class="token namespace">[common]</span> server_addr = www<span class="token punctuation">.</span>yizhaocy<span class="token punctuation">.</span>com server_port = 7001 token = 111111 admin_addr = 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1 admin_port = 7401 admin_user = admin admin_pwd = admin log_file = <span class="token punctuation">.</span><span class="token operator">/</span>frpc<span class="token punctuation">.</span>log log_level = info <span class="token namespace">[www.yizhaocy.com]</span> <span class="token function">type</span> = http local_ip = 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1 local_port = 8666 custom_domains = www<span class="token punctuation">.</span>yizhaocy<span class="token punctuation">.</span>com<span class="token namespace">[common]</span> server_addr = www<span class="token punctuation">.</span>yizhaocy<span class="token punctuation">.</span>com server_port = 7001 token = 111111 admin_addr = 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1 admin_port = 7401 admin_user = admin admin_pwd = admin log_file = <span class="token punctuation">.</span><span class="token operator">/</span>frpc<span class="token punctuation">.</span>log log_level = info <span class="token namespace">[www.yizhaocy.com]</span> <span class="token function">type</span> = http local_ip = 127<span class="token punctuation">.</span>0<span class="token punctuation">.</span>0<span class="token punctuation">.</span>1 local_port = 8666 custom_domains = www<span class="token punctuation">.</span>yizhaocy<span class="token punctuation">.</span>com[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
© 版权声明
声明📢本站内容均来自互联网,归原创作者所有,如有侵权必删除。
本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。
THE END