Skip to content

Instantly share code, notes, and snippets.

@imyelo
Last active April 29, 2024 04:34
Show Gist options
  • Star 36 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save imyelo/b6c3d3d9383f7d5623f06a0c11052530 to your computer and use it in GitHub Desktop.
Save imyelo/b6c3d3d9383f7d5623f06a0c11052530 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