mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 09:57:01 +00:00
Caddy loves Iris
The Caddyfile shows how you can use caddy to listen on ports 80 & 443 and sit in front of iris webserver(s) that serving on a different port (9091 and 9092 in this case; see Caddyfile).
Running our two web servers
- Go to
$GOPATH/src/github.com/kataras/iris/_examples/caddy/server1 - Open a terminal window and execute
go run main.go - Go to
$GOPATH/src/github.com/kataras/iris/_examples/caddy/server2 - Open a new terminal window and execute
go run main.go
Caddy installation
- Download caddy: https://caddyserver.com/download
- Extract its contents where the
Caddyfileis located, the$GOPATH/src/github.com/kataras/iris/_examples/caddyin this case - Open, read and modify the
Caddyfileto see by yourself how easy it is to configure the servers - Run
caddydirectly or open a terminal window and executecaddy - Go to
https://example.comandhttps://api.example.com/user/42
Notes
Iris has the app.Run(iris.AutoTLS(":443", "example.com", "mail@example.com")) which does
the exactly same thing but caddy is a great tool that helps you when you run multiple web servers from one host machine, i.e iris, apache, tomcat.