Skip to content

frp怎样开机启动和后台运行? #176

@piiiiiiiiiiiiiii

Description

@piiiiiiiiiiiiiii

两个问题:
1.在centos上如何开机运行?
2.怎样后台运行,而不用一直开着putty

谢谢


已经解决:

二更@20210519
现在下载的frp打包文件目录内,已经写好了后台运行启动文件,比如服务器端,只需要把frps.service复制一份到/etc/systemd/system目录下即可。

如果想自己手写,参照如下:

使用systemd配置开机自启,适用于 centos7 Ubuntu 16 或 debian 8。

vi /etc/systemd/system/frps.service 新建此文件,并写入以下内容
:
[Unit]
Description=frps daemon

[Service]
Type=simple
ExecStart=/usr/bin/frps -c /etc/frps/frps.ini

[Install]
WantedBy=multi-user.target

启动并设为开机自启。
$ systemctl start frps
$ systemctl enable frps

参照:lcbk.net/9766.html

------------centos6.5及以下---------------------
vi /etc/rc.local
在最下面加一行/usr/sbin/frp/frps -c /usr/sbin/frp/frps.ini
其中 /usr/sbin/frp是程序放置的目录,重启ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions