Skip to content
Argo Tunnel
Visit Argo Tunnel on GitHub
Set theme to dark (⇧+D)

Run as a service

Argo Tunnel can install itself as a system service on Linux and Windows and as a launch agent on macOS.

By default, Argo Tunnel expects all of the configuration to exist in the cloudflared/config.yml configuration file. The available options are documented on the configuration file reference, but at a minimum you must specify the following arguments to run as a service:

ArgumentDescription
urlThe destination for proxied traffic in your environment if your origin is not listening on localhost:8080
tunnelThe UUID of your Tunnel
credentials-fileThe location of the credentials file for your Tunnel

Linux

Run the following command:

$ sudo cloudflared service install

If you have already logged in and have a configuration file in ~/.cloudflared/, these will be copied to /etc/cloudflared/.

If you do not have a configuration file, you will need to create a config.yml file with fields listed above. You can pass a custom file by running cloudflared --config CONFIG-FILE service install.

macOS

Run at login

Open a Terminal and run the following command:

$ cloudflared service install

Argo Tunnel will be installed as a launch agent, and start whenever you log in, using your local user configuration found in ~/.cloudflared/.

Manually start the service

Run the following command:

$ launchctl start com.cloudflare.cloudflared

Output will be logged to ~/Library/Logs/com.cloudflare.cloudflared.err.log and ~/Library/Logs/com.cloudflare.cloudflared.out.log.

Run at boot

Run the following command:

$ sudo cloudflared service install

Argo Tunnel will be installed as a launch daemon, and start whenever your system boots, using your configuration found in /etc/cloudflared.

Manually start the service

Run the following command:

$ sudo launchctl start com.cloudflare.cloudflared

Output will be logged to /Library/Logs/com.cloudflare.cloudflared.err.log and /Library/Logs/com.cloudflare.cloudflared.out.log.

Windows

To run as a service on Windows, you must specify four arguments in the configuration file.

ArgumentDescription
urlThe destination for proxied traffic in your environment if your origin is not listening on localhost:8080
tunnelThe UUID of your Tunnel
credentials-fileThe location of the credentials file for your Tunnel
logfileThe location to store cloudflared logs`
  1. Open a Command Prompt with Administrator privileges.

  2. Type the following command:

PS C:\Cloudflared> .\cloudflared.exe service install

Assuming Windows is installed to C:\, when running as a service, Argo Tunnel expects its configuration at:

C:\Windows\system32\config\systemprofile\.cloudflared\config.yml .

You can copy your local configuration from:

%UserProfile%\.cloudflared\config.yml.

Specify a custom location for the config file

By default, the Windows service runs in “access” client mode. If you need to specify a custom config file location, you can do so in the Windows registry after the service has been installed (MSDN reference):

  1. Open regedit.
  2. Go to the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cloudflared.
  3. Edit the ImagePath value to include --config <path-to-config>.

Additionally, you will need to add tunnel run arguments and, in some cases, a pointer to the config file. For example: .../cloudflared.exe tunnel [--config FILE] run.

Start the service

To start the service, go to Service Manager and start the Argo Tunnel agent service, or run the following command:

C:\> sc start cloudflared

If you are a Powershell user, run this command instead:

PS C:> Start-Service cloudflared

cloudflared will set up Recovery Properties of the service so it restarts on failure, but this feature is not fully supported on Windows Server 2003 and Windows XP.