Getting error -Caddyfile:4: unrecognized directive: timeouts

1. Caddy version (caddy version):

v2.2.0

2. How I run Caddy:

I am running caddy on my ubuntu vps . The Caddyfile is meant to act as a reverse proxy for my emby server which is hosted on the very same vps

a. System environment:

Ubuntu 20 ( x86_64 )

b. Command:

caddy start

c. My complete Caddyfile or JSON config:

 domain.ga, http://xxx.xxx.xxx.xxx:2015 www.domaim.ga {
    
    tls my@email.com
    timeouts none
    gzip

    # Optional security headers
    header / {
    -Server
    Strict-Transport-Security "max-age=31536000;"
        Cache-Control "public, max-age=31536000"
    Referrer-Policy "strict-origin"
    X-XSS-Protection "1; mode=block"
    X-Content-Type-Options "nosniff"
    X-Frame-Options "DENY"
    }

    errors {
        404 /redir-target/NoSignal404.html
        320 /redir-target/NoSignal404.html
    }

    nobots "https://blog.haschek.at/tools/bomb.php" {
           "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
           "Googlebot/2.1 (+http://www.google.com/bot.html)"
           "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36    (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
        "Googlebot-News"
       "Googlebot-Image/1.0"
       "Googlebot-Video/1.0"
       "compatible; Mediapartners-Google/2.1; +http://www.google.com/bot.html"
       "Mediapartners-Google"
       "AdsBot-Google (+http://www.google.com/adsbot.html)"
       "AdsBot-Google-Mobile-Apps"
       "APIs-Google (+https://developers.google.com/webmasters/APIs-Google.html)"
       regexp "Googlebot"
       public "^/public"
         public "^/[a-z]{,5}/public"
   }


    # Optional logging
   log home.log

}

subdomain.domaim.ga http://xxx.xxx.xxx.xxx:2022 {
    tls my@email.com
    timeouts none
    gzip
    cors / {
    origin          *
        origin            http://ask-ifr-download.s3.amazonaws.com https://ask-ifr-download.s3.amazonaws.com
        methods           GET
    allowed_headers      *
        
    }
    proxy / localhost:8096 {
        websocket
        transparent
    }

    header / {
    -Server
    Access-Control-Allow-Origin  *
    Access-Control-Allow-Methods "GET, POST, OPTIONS"
    Strict-Transport-Security "max-age=31536000;"
        Cache-Control "public, max-age=31536000"
    Referrer-Policy "strict-origin"
    X-XSS-Protection "1; mode=block"
    X-Content-Type-Options "nosniff"
    X-Frame-Options "DENY"
    }

    errors {
        404 /redir-target/NoSignal404.html
        320 /redir-target/NoSignal404.html
    }

    nobots "https://blog.haschek.at/tools/bomb.php" {
           "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
           "Googlebot/2.1 (+http://www.google.com/bot.html)"
       "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
        "Googlebot-News"
       "Googlebot-Image/1.0"
       "Googlebot-Video/1.0"
       "compatible; Mediapartners-Google/2.1; +http://www.google.com/bot.html"
       "Mediapartners-Google"
       "AdsBot-Google (+http://www.google.com/adsbot.html)"
       "AdsBot-Google-Mobile-Apps"
       "APIs-Google (+https://developers.google.com/webmasters/APIs-Google.html)"
       regexp "Googlebot"
       public "^/public"
         public "^/[a-z]{,5}/public"
    }

    # Optional logging
    log emby.log

} 

3. The problem I’m having:

I am unable to start the caddy server , it always returns the following error

root@xd003:~# caddy start        
                                                      
2020/09/28 04:07:28.852 INFO    using adjacent Caddyfile
                               
run: adapting config using caddyfile: Caddyfile:4: unrecognized directive: timeouts    

start: caddy process exited with error: exit status 1     
                            
 root@xd003:~#

PS / I don’t really have any knowledge of caddy .The config file has been taken from a user in emby forums. Apart from the solution to the main issue , any suggestions or improvements in Caddyfile is highly appreciated .Since the vps server location is quite far away , i am just trying to use caddy as reverse proxy + cloudfare for routing all the data to improve performance and reduce peering issues of my emby server as much as possible

That looks like a Caddy v1 config. Caddy v2 is a complete rewrite, so they aren’t compatible.

I highly recommend you read through the docs to get a feel for how it works. It’s hard to really point at any specific thing right now because most of that config is not directly applicable to Caddy v2.

You can start here:

You can take a look at the upgrade guide to get an idea of what changed, in broad strokes:

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.