Caddy and CGI unrecognized directive: cgi

1. Caddy version (caddy version):

Caddy2

2. How I run Caddy:

I am using Caddy in a docker from dockerhub.
Works fine, just need help to find out how to use cgi in the docker image

a. System environment:

Docker, linux

b. Command:

paste command here

c. Service/unit/compose file:

version: '3.5'
services:
  caddy:
    image: caddy
    container_name: caddy_web_proxy
    volumes:
      - ./certs:/data/caddy  # to save certificates on disk
      - ./Caddyfile:/etc/caddy/Caddyfile  # to mount custom Caddyfile
    ports:
      - "80:80"
      - "443:443"
    #network_mode: host
    networks:
      web-backend-network:
        aliases:
          - caddy

networks:
  web-backend-network:
    name: web-backend-network
    driver: bridge
    driver_opts:
      com.docker.network.bridge.name: br-web-caddy
    ipam:
      driver: default


d. My complete Caddyfile or JSON config:

homeassistent.xxx.xxx.xxx, homeassistant.xxx.xxx.xxx {
	file_server
	reverse_proxy homeassistent:8123
}


webkey.xxx.xxx.xxx {
	cgi /publickey.sh /srv/webkey/publickey.sh
}

3. The problem I’m having:

4. Error messages and/or full log output:

caddy_web_proxy | {“level”:“info”,“ts”:1590773428.563543,“msg”:“autosaved config”,“file”:"/config/caddy/autosave.json"}
caddy_web_proxy | {“level”:“info”,“ts”:1590773428.5636163,“msg”:“serving initial configuration”}
caddy_web_proxy | {“level”:“info”,“ts”:1590773705.99914,“msg”:“shutting down apps then terminating”,“signal”:“SIGTERM”}
caddy_web_proxy | 2020/05/29 17:35:05 [INFO][cache:0x3e20080] Stopped certificate maintenance routine
caddy_web_proxy | {“level”:“info”,“ts”:1590773706.000049,“logger”:“admin”,“msg”:“stopped previous server”}
caddy_web_proxy | {“level”:“info”,“ts”:1590773706.0000997,“msg”:“shutdown done”,“signal”:“SIGTERM”}
caddy_web_proxy | {“level”:“info”,“ts”:1590773709.5495799,“msg”:“using provided configuration”,“config_file”:"/etc/caddy/Caddyfile",“config_adapter”:“caddyfile”}
caddy_web_proxy | run: adapting config using caddyfile: /etc/caddy/Caddyfile:8: unrecognized directive: cgi

5. What I already tried:

I searched to Caddy2 documentation but I could not find anything about cgi, only fastcgi.

6. Links to relevant resources:

The cgi directive was a plugin in Caddy v1. No such plugin has been written yet for Caddy v2. You can read more about it here:

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