服务器安装frps实现内网穿透(1)-ubuntu上安装frps

Frp官方文档:https://gofrp.org/docs/

Github项目地址:https://github.com/fatedier/frp

发行版安装包:https://github.com/fatedier/frp/releases

1、首先创建文件夹并下载解压所需安装包

mkdir /etc/frps

cd /etc/frps

wget https://github.com/fatedier/frp/releases/download/v0.45.0/frp_0.45.0_linux_amd64.tar.gz

tar -xvf frp_0.45.0_linux_amd64.tar.gz

使用systemctrl可以方便管理

vim /etc/systemd/system/frps.service

加入如下内容:
[Unit]
# 服务名称,可自定义
Description = frp server
After = network.target syslog.target
Wants = network.target

[Service]
Type=simple
ExecStart=/etc/frps/frps -c /etc/frps/frps.ini
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
StandardOutput=syslog
StandardError=inherit

[Install]
WantedBy=multi-user.target

写入后就可以用systemctl命令管理frps
# 启动frp
systemctl start frps
# 停止frp
systemctl stop frps
# 重启frp
systemctl restart frps
# 查看frp状态
systemctl status frps
#开机自启
systemctl enable frps
接下来还需要给frps服务分配端口

vim /etc/frps/frps.ini
写入内容:
[common]
bind_port = 9003

vhost_http_port = 9004
vhost_https_port = 9005

token = 1234567890

# Web
dashboard_port = 8080
dashboard_user = admin
dashboard_pwd = 1234567890

至此服务端的frps就安装完成了,后面配置好客户端的frpc就可以内网穿透了。9003 9004 9005端口可以自定义,其中bind_port是服务端口,vhost_http_port是http使用的端口,vhost_https_port是https使用的端口,8080是管理页面的端口,服务器ip:8080可以打开管理网页查看连接状态等。

猜你喜欢

转载自blog.csdn.net/q52875991/article/details/128252467