How to use this module with apps.http file_server? i got HTTP 404 ERROR
crapthings opened this issue · 4 comments
crapthings commented
This zz-chatgpt-admin.lvyanhui.com page can’t be foundNo webpage was found for the web address: https://zz-chatgpt-admin.lvyanhui.com:29001/
HTTP ERROR 404
{
"level": "debug",
"ts": 1684151808.2095692,
"logger": "http.handlers.file_server",
"msg": "sanitized path join",
"site_root": "/www/wwwroot/zz-chatgpt-admin.lvyanhui.com",
"request_path": "/",
"result": "/www/wwwroot/zz-chatgpt-admin.lvyanhui.com"
}
{
"level": "debug",
"ts": 1684151808.2096467,
"logger": "http.log.error",
"msg": "{id=x4qxfu6xr} fileserver.(*FileServer).notFound (staticfiles.go:579): HTTP 404",
"request": {
"remote_ip": "1.62.161.126",
"remote_port": "16672",
"proto": "HTTP/3.0",
"method": "GET",
"host": "zz-chatgpt-admin.lvyanhui.com:29001",
"uri": "/",
"headers": {
"Sec-Ch-Ua": [
"\"Google Chrome\";v=\"113\", \"Chromium\";v=\"113\", \"Not-A.Brand\";v=\"24\""
],
"Sec-Ch-Ua-Platform": [
"\"macOS\""
],
"Sec-Fetch-Site": [
"none"
],
"Accept-Encoding": [
"gzip, deflate, br"
],
"Cache-Control": [
"max-age=0"
],
"Accept-Language": [
"en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7"
],
"Sec-Ch-Ua-Mobile": [
"?0"
],
"Sec-Fetch-Mode": [
"navigate"
],
"Cookie": [],
"User-Agent": [
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
],
"Accept": [
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"
],
"Sec-Fetch-User": [
"?1"
],
"Sec-Fetch-Dest": [
"document"
],
"Upgrade-Insecure-Requests": [
"1"
]
},
"tls": {
"resumed": false,
"version": 0,
"cipher_suite": 0,
"proto": "",
"server_name": ""
}
},
"duration": 0.000077034,
"status": 404,
"err_id": "x4qxfu6xr",
"err_trace": "fileserver.(*FileServer).notFound (staticfiles.go:579)"
}
logging:
logs:
default:
level: DEBUG
storage:
"module": "file_system"
"root": "/data"
apps:
tls:
certificates:
automate:
- foxim-live.lvyanhui.com
- foxim-turn.lvyanhui.com
- zz-chatgpt-api.lvyanhui.com
- zz-chatgpt-admin.lvyanhui.com
- zz-chatgpt-pc.lvyanhui.com
- zz-chatgpt-m.lvyanhui.com
http:
servers:
chatgpt:
listen:
- ":29001"
routes:
- match:
- host:
- zz-chatgpt-api.lvyanhui.com
handle:
- handler: reverse_proxy
upstreams:
- dial: 127.0.0.1:7156
- match:
- host:
- zz-chatgpt-admin.lvyanhui.com
handle:
- handler: file_server
root: "/www/wwwroot/zz-chatgpt-admin.lvyanhui.com"
# - match:
# - host:
# - zz-chatgpt-pc.lvyanhui.com
# handle:
# - handler: file_server
# root: "/www/wwwroot/zz-chatgpt-pc.lvyanhui.com"
# pass_thru: true
# - match:
# - host:
# - zz-chatgpt-m.lvyanhui.com
# handle:
# - handler: file_server
# root: "/www/wwwroot/zz-chatgpt-m.lvyanhui.com"
# pass_thru: true
layer4:
servers:
main:
listen: [":443"]
routes:
- match:
- tls:
sni:
- "foxim-turn.lvyanhui.com"
handle:
- handler: tls
- handler: proxy
upstreams:
- dial: ["localhost:5349"]
- match:
- tls:
sni:
- "foxim-live.lvyanhui.com"
handle:
- handler: tls
connection_policies:
- alpn: ["http/1.1"]
- handler: proxy
upstreams:
- dial: ["localhost:7880"]
emilylange commented
What does the directory structure of your /www/wwwroot/zz-chatgpt-admin.lvyanhui.com
look like?
And what file did you expect to hit?
crapthings commented
What does the directory structure of your
/www/wwwroot/zz-chatgpt-admin.lvyanhui.com
look like? And what file did you expect to hit?
there's default nginx template file
but none of these are accessable and 1.txt doesn't work too
btw zz-chatgpt-api.lvyanhui.com this reverse proxy api works, but file_server is not
crapthings commented
still 404 after remove every thing
logging:
logs:
default:
level: DEBUG
storage:
"module": "file_system"
"root": "/data"
apps:
tls:
certificates:
automate:
- zz-chatgpt-admin.lvyanhui.com
http:
servers:
chatgpt:
listen:
- ":443"
routes:
- match:
- host:
- zz-chatgpt-admin.lvyanhui.com
handle:
- handler: file_server
root: "/www/wwwroot/zz-chatgpt-admin.lvyanhui.com"
francislavoie commented
I recommend writing a Caddyfile to do what you want first, then running caddy adapt --pretty
to see what the JSON for it looks like. It'll give you a better base for your config.