This articles is published 563 days ago and last updated 563 days ago, some information may be out of date.
About:
WinSW
is a utility that allows you to wrap and manage a Windows service for any executable.
frpc
is a client for the frp
(Fast Reverse Proxy) tool, which enables you to expose local servers to the internet.
Procedure:
To set up frpc
as a Windows service using WinSW
, follow these steps:
- Download
WinSW
- Download the latest release of WinSW from the releases page. Choose the appropriate executable for your system, either
WinSW-x64.exe
orWinSW-x86.exe
.
- Rename
WinSW
executable
- Rename the downloaded
WinSW
executable tofrpc-winsw.exe
. This will be the service wrapper for thefrpc
executable.
- Create a configuration file
- Create a new XML configuration file named
frpc-winsw.xml
in the same directory as thefrpc-winsw.exe
. Add the following content to the file:
<service>
<id>frpc</id>
<name>frpc</name>
<description>frp client service managed by WinSW</description>
<executable>path\to\frpc.exe</executable>
<arguments>-c path\to\frpc.ini</arguments>
<log mode="roll-by-size">
<sizeThreshold>10485760</sizeThreshold>
<keepFiles>3</keepFiles>
</log>
<onfailure action="restart" />
<startmode>Automatic</startmode>
</service>
- Replace
path\to\frpc.exe
with the actual path to yourfrpc.exe
file. - Replace
path\to\frpc.ini
with the actual path to yourfrpc.ini
configuration file.
- Install the service
- Open a command prompt or PowerShell window with administrator privileges. Navigate to the directory containing
frpc-winsw.exe
andfrpc-winsw.xml
. - Run the following command to install the service:
.\frpc-winsw.exe install
Installing service 'frpc (frpc)'...
Service 'frpc (frpc)' was installed successfully.
- Start the service
- After installing the service, start it by running the following command:
.\frpc-winsw.exe start
Service 'frpc (frpc)' was refreshed successfully.Starting service 'frpc (frpc)'...
Service 'frpc (frpc)' started successfully.
Also, we can restart a Windows service from the command line (alternative)
net stop frpc
The frpc service is stopping.
The frpc service was stopped successfully.
net start frpc
The frpc service is starting.
The frpc service was started successfully.
Conclusion:
frpc
is set up as a Windows service and will automatically start on system boot. You can manage the service using the Services
management console or by using the frpc-winsw.exe
commands, such as stop
, restart
, and uninstall
.