

电脑技术:在CentOS上将frp内网穿透服务注册为服务并开启自启动且失效自启动
source link: https://www.taholab.com/25200
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

电脑技术:在CentOS上将frp内网穿透服务注册为服务并开启自启动且失效自启动
虽然可以通过frp自带的服务文件来做,但事实发现其实不如手动配置来的靠谱,因为还需要做一些修改,所以不如直接手动添加服务。
首先做好frp服务配置,服务端和客户端案例分别如下:
服务端配置和自动设置
创建服务脚本并编辑
vi /etc/systemd/system/frps.service
内容如下:(注意,代码中的frps.ini是服务端配置文件,请依据自己的实际情况做相应修改)
[Unit] Dcription=The nginx HTTP and reverse proxy server After=network.target remote-fs.target nss-lookup.target [Service] Type=simple User=root Restart=on-failure ExecStart=/root/frp/frps -c /root/frp/frps.ini ExecReload=/root/frp/frps -c /root/frp/frps.ini KillSignal=SIGQUIT TimeoutStopSec=5 KillMode=process PrivateTmp=true StandardOutput=syslog StandardError=inherit [Install] WantedBy=multi-user.target |
加入服务列表并设置自启动
#重新加载服务列表 systemctl daemon-reload #将frps加入开机自启动 systemctl enable frps.service #启动服务 systemctl start frps.service #以下是其他常用命令 #关闭服务 systemctl stop frps.service #重启服务 systemctl restart frps.service #显示服务的状态 systemctl status frps.service #禁用服务开机启动 systemctl disable frps.service #查看服务是否开机启动 systemctl is-enabled frps.service #查看已经启动的服务列表 systemctl list-unit-files|grep enable #查看启动失败的服务列表 systemctl --failed配置和自启动设置 |
客户端配置和自动设置
客户端与服务端配置方法完全一致,代码如下:
创建服务脚本并编辑
vi /etc/systemd/system/frpc.service
内容如下:(注意,代码中的frpc.ini是服务端配置文件,请依据自己的实际情况做相应修改)
[Unit] Dcription=The nginx HTTP and reverse proxy server After=network.target remote-fs.target nss-lookup.target [Service] Type=simple User=root Restart=on-failure ExecStart=/root/frp/frpc -c /root/frp/frpc.ini ExecReload=/root/frp/frpc -c /root/frp/frpc.ini KillSignal=SIGQUIT TimeoutStopSec=5 KillMode=process PrivateTmp=true StandardOutput=syslog StandardError=inherit [Install] WantedBy=multi-user.target |
加入服务列表并设置自启动
#重新加载服务列表 systemctl daemon-reload #将frpc加入开机自启动 systemctl enable frpc.service #启动服务 systemctl start frpc.service #以下是其他常用命令 #关闭服务 systemctl stop frpc.service #重启服务 systemctl restart frpc.service #显示服务的状态 systemctl status frpc.service #禁用服务开机启动 systemctl disable frpc.service #查看服务是否开机启动 systemctl is-enabled frpc.service #查看已经启动的服务列表 systemctl list-unit-files|grep enable #查看启动失败的服务列表 systemctl --failed |
Recommend
-
89
本文前提: 一台搭载了2核4G的qcloud标准版云服务器,假设叫s1(分配了公网IP); s1的操作系统是Ubuntu 16.04.1 LTS 64bit; 本文目录:
-
13
受制于第三方内网穿透服务的各种限制,加上自己恰好有台云服务器,因此通过 frp 搭建了内网穿透服务。 首先,...
-
9
最近工作中有公网访问内网服务的需求,便了解了内网穿透相关的知识。发现原理和实现都不复杂,遂产生了设计一个内网穿透的想法。 名字想好了,就叫QuantumTunnel,量子隧道,名字来源于
-
7
CentOS 7 下搭建自己的 ngrok 内网穿透服务 date_range更新于 2019/12/26 info 现在的...
-
8
欢迎使用 Frp 内网穿透服务 date_range更新于 2019/12/04 info 近期收到部分群友反馈,ngro...
-
6
别人是无法通过一个链接访问到你家里的电脑的某个文件夹里面的文件的,因为你家里的电脑属于内网,而能通过一个链接去访问的属于公网,所以这就需要使用【内网穿透】这一个技术概念去实现远程访问家里电脑。frp是什么frp是一个专注于内网穿透的...
-
6
How to use the Kinect as a webcam on Windows 10 Here’s what you need to do to use the Kinect as a webcam on Windows 10: 1. Install Kinect for Win...
-
7
搭建ngrok服务(内网穿透) 2015-09-09 技术
-
9
frps(服务端)即远程服务器,简单点就是阿里云服务器。frpc(客户端)即个人手机笔记本电脑等。一、安装服务端(frps)wget https://code.aliyun.com/MvsCode/frps-onekey/raw/master/install-frps.sh -O ./install-fr...
-
7
V2EX › 分享创造 基于 SSH 的内网穿透服务免费提供支持
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK