Skip to content

Instantly share code, notes, and snippets.

@frankleng
Forked from imyelo/frpc.service
Created July 19, 2021 06:38
Show Gist options
  • Save frankleng/5674f69cbfbed0271bda5a3ab29d5dd6 to your computer and use it in GitHub Desktop.
Save frankleng/5674f69cbfbed0271bda5a3ab29d5dd6 to your computer and use it in GitHub Desktop.
run frp client as a service on windows and ubuntu / debian
# 1. put frpc and frpc.ini under /usr/local/frpc/
# 2. put this file (frpc.service) at /etc/systemd/system
# 3. run `sudo systemctl daemon-reload && sudo systemctl enable frpc && sudo systemctl start frpc`
# Then we can manage frpc with `sudo service frpc {start|stop|restart|status}`
# See also: https://nosame.net/use-frp-to-reverse-proxy-your-nas/
# Alternative for server:
# - Offical: https://github.com/fatedier/frp/blob/a4cfab6/conf/systemd/frpc%40.service
[Unit]
Description=frp client
Wants=network-online.target
After=network.target network-online.target
[Service]
ExecStart=/usr/local/frpc/frpc -c /usr/local/frpc/frpc.ini
[Install]
WantedBy=multi-user.target
: 1. download [nssm](https://github.com/kirillkovalenko/nssm) and set its diretory into the global PATH environment value
: 2. replace the path below with where you placed frpc
nssm install frpc "D:\Tools\frpc\frpc.exe" "-c D:\Tools\frpc\frpc.ini"
nssm set frpc DisplayName "frp client"
nssm start frpc
nssm stop frpc
nssm remove frpc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment