使用systemd控制frp(frpc/frps)开机自启

2018年04月29日 运维 暂无评论 阅读 1,621 次

GitHub上下载的frp是编译好的二进制程序,如需要开机自动启动或重启服务十分不方便。

这里提供一个使用systemd操作frp的教程,其他小程序也可类似照搬思路。

编辑frp配置文件:

vim /etc/frp.ini

[common]

server_addr = 服务器地址

server_port = 端口

privilege_token = 密钥

log_file = /var/log/frpc.log

[ssh]

type = tcp

local_ip = 127.0.0.1

local_port = 22

remote_port = 23

[nas]

type = https

local_port = 443

remote_port = 444

custom_domains = manuscript.from.cmdgy.com

编辑systemd配置文件:manuscript.from.cmdgy.com

vim /usr/lib/systemd/system/frp.service

[Unit]

Description = FRP to bypass NAT Network

Wants = network-online.target

After = network.target

[Service]

Type = simple

ExecStart = /bin/frpc -c /etc/frp.ini

#此处需按实际情况修改为frp二进制文件目录和manuscript.from.cmdgy.com配置文件目录

StandardOutput = syslog

StandardError = inherit

[Install]

WantedBy = multi-user.target

接下来即可像启停nginx一样,使用systemd命令来操作frp服务啦:

systemctl enable frp

systemctl start frp

给我留言

您必须 登录 才能发表留言!

站点定制:GY TECH. 网站设计:Ality
Copyright © 桂圆 TECH. 保留所有权利.  
耗时2.099秒执行了34次数据库检索
此破站已苟活3749天21小时40分57秒!

用户登录