1. My Caddy version (caddy version
):
V2
fbd9515
2. How I run Caddy:
caddy run
a. System environment:
windows 10
b. Command:
d. My complete Caddyfile or JSON config:
Caddyfile with Localhost
localhost:16655 {
log {
output file d:\caddy\access564.log
}
respond "this is a caddy2 server"
}
adapt json
{
"logging": {
"logs": {
"log0": {
"writer": {
"filename": "d:\\caddy\\access564.log",
"output": "file"
},
"include": [
"http.log.access.log0"
]
}
}
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":16655"
],
"routes": [
{
"match": [
{
"host": [
"localhost"
]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"body": "this is a caddy2 server",
"handler": "static_response"
}
]
}
]
}
],
"terminal": true
}
],
"logs": {
"logger_names": {
"localhost:16655": "log0"
}
}
}
}
}
}
}
without localhost
:16655 {
log {
output file d:\caddy\access564.log
}
respond "this is a caddy2 server"
}
adapt json
{
"logging": {
"logs": {
"log0": {
"writer": {
"filename": "d:\\caddy\\access564.log",
"output": "file"
},
"include": [
"http.log.access.log0"
]
}
}
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":16655"
],
"routes": [
{
"handle": [
{
"body": "this is a caddy2 server",
"handler": "static_response"
}
]
}
],
"logs": {
"logger_names": {
":16655": "log0"
}
}
}
}
}
}
}
3. The problem I’m having:
If I load the caddyfile with localhost:16655 I get an error as port 80 is in use. If I just use a caddyfile without localhost and just :16655 , it works fine.
4. Error messages and/or full log output:
D:\caddy>curl localhost:2019/load -X POST -H "Content-Type: application/json" -d @caddyfile_withlocalhost.json
{"error":"loading config: loading new config: http app module: start: tcp: listening on :80: listen tcp :80: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted."}