Is the adapter broken ?
HammerZ3it opened this issue · 1 comments
Hi there,
I wanted to use your adapter to convert our actual nginx configuration to caddy but it seems it is not working anymore as I'm following your doc , xcaddy, etc....
And I endup using your testing configuration (from git) and this is what the cmd give me :
prproxyfront01t:/tmp/ngin# ./caddy run --config nginx.conf --adapter nginx 2020/11/24 08:47:56.721 INFO using provided configuration {"config_file": "nginx.conf", "config_adapter": "nginx"} [WARNING][nginx] nginx.conf:1: server: unrecognized or unsupported nginx directive 2020/11/24 08:47:56.722 INFO admin admin endpoint started {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["127.0.0.1:2019", "localhost:2019", "[::1]:2019"]} 2020/11/24 08:47:56.722 INFO autosaved config {"file": "/root/.config/caddy/autosave.json"} 2020/11/24 08:47:56.722 INFO serving initial configuration 2020/11/24 08:47:56.722 INFO tls cleaned up storage units 2020/11/24 08:47:56.723 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc0002e77a0"}
As you can see, it can't recognize first directive of nginx : server.
This is what I've done to build it :
- go get -u github.com/caddyserver/xcaddy/cmd/xcaddy
- go build ~/go/src/github.com/caddyserver/xcaddy/cmd/xcaddy/main.go
- ~/go/bin/xcaddy build --with github.com/caddyserver/nginx-adapter
- ./caddy run --config nginx.conf --adapter nginx
Content of nginx.conf
`server {
listen 80;
server_name domain3.com www.domain3.com;
access_log logs/domain3.access.log main;
root html;
location ~ .php$ {
fastcgi_pass 127.0.0.1:1025;
}
}`
Caddy version :
prproxyfront01t:/tmp/ngin# caddy version v2.0.1-0.20200605181936-1dfb11486eac h1:8wT/DuNN9rfMVBglyiPCxaCkVi1ZFVz+NA8pLoaEkFM=
I think your server
block needs to be inside of an http
context.