Windows (3)

Last updated Sep 11, 2026 You can install cloudflared as a system service on Windows.

Configure cloudflared as a service

By default, Cloudflare Tunnel expects all of the configuration to exist in the %USERPROFILE%\.cloudflared\config.yml configuration file. At a minimum you must specify the following arguments to run as a service:

Argument Description
tunnel The UUID of your tunnel
credentials-file The location of the credentials file for your tunnel

Run cloudflared as a service

  1. Download the latest cloudflared version.
  2. Create a new directory:

bash C:\Cloudflared\bin

  1. Copy the .exe file you downloaded in step 1 to the new directory and rename it to cloudflared.exe.
  2. Open CMD as an administrator and go to C:\Cloudflared\bin.
  3. Run this command to install cloudflared:

bash cloudflared.exe service install

  1. Next, run this command to create another directory:

bash mkdir C:\Windows\System32\config\systemprofile\.cloudflared

  1. Log in and authenticate cloudflared:

bash cloudflared.exe login

  1. The login command will generate a cert.pem file and save it to your user profile by default. Copy the file to the .cloudflared folder created in step 5 using this command:

bash copy C:\Users\%USERNAME%\.cloudflared\cert.pem C:\Windows\System32\config\systemprofile\.cloudflared\cert.pem

  1. Next, create a tunnel:

bash cloudflared.exe tunnel create <Tunnel Name>

This will generate a credentials file in .json format. 10. Create a configuration file with the following content:

```txt
tunnel: <Tunnel ID>
credentials-file: C:\Windows\System32\config\systemprofile\.cloudflared\<Tunnel-ID>.json
# Uncomment the following two lines if you are using self-signed certificates in your origin server
# originRequest:
#   noTLSVerify: true

ingress:
  - hostname: app.mydomain.com
    service: https://internal.mydomain.com
  - service: http_status:404
logfile:  C:\Cloudflared\cloudflared.log
```
  1. Copy the credentials file to the folder created in step 6:

    bash copy C:\Users\%USERNAME%\.cloudflared\<Tunnel-ID>.json C:\Windows\System32\config\systemprofile\.cloudflared\<Tunnel-ID>.json

  2. Validate the ingress rule entries in your configuration file using the command:

    bash cloudflared.exe tunnel ingress validate

  3. In the Registry Editor, go to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cloudflared.

  4. In the Cloudflared registry entry, modify ImagePath to point to the cloudflared.exe and config.yml files. Make sure that there are no extra spaces or characters while you modify the registry entry, as this could cause problems with starting the service.

    bash C:\Cloudflared\bin\cloudflared.exe --config=C:\Windows\System32\config\systemprofile\.cloudflared\config.yml tunnel run

  5. If the service does not start, run the following command from C:\Cloudflared\bin:

    bash sc start cloudflared

    You will see the output below:

    txt SERVICE_NAME: cloudflared TYPE : 10 WIN32_OWN_PROCESS STATE : 2 START_PENDING (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x7d0 PID : 3548 FLAGS :

Next steps

You can now route traffic through your tunnel. If you add IP routes or otherwise change the configuration, restart the service to load the new configuration:

sc stop cloudflared
sc start cloudflared

Was this helpful?

YesNo

On this page

Windows (3) - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/tunnel/features/locally-managed-tunnels/as-a-service/windows/#page","headline":"Windows","description":"Install and run cloudflared as a Windows service.","url":"https://developers.cloudflare.com/tunnel/features/locally-managed-tunnels/as-a-service/windows/","inLanguage":"en","image":"https://developers.cloudflare.com/tunnel/features/locally-managed-tunnels/as-a-service/windows/og.png?v=670a5f401668b36b","dateModified":"2026-09-11","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["Windows"]}


description: Configure locally-managed tunnels with a YAML configuration file. title: Configuration file image: https://developers.cloudflare.com/tunnel/features/locally-managed-tunnels/configuration-file/og.png?v=c8817e9723a6d5f8


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/tunnel/llms.txt
Use this file to discover all available pages before exploring further.