我是 的初学者traefik
,我正在尝试在下lighttpd
进行日志记录工作。docker compose
lighttpd
docker compose
我的lighttpd.conf
文件包含:
server.modules = (
"mod_debug",
"mod_accesslog",
"mod_dirlisting",
"mod_indexfile",
)
server.document-root = "/var/www/lighttpd8081/html"
server.errorlog = "/var/log/lighttpd/error.log"
server.port = 80
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png"
)
accesslog.filename = "/var/log/lighttpd/access.log"
debug.log-request-header-on-error = "enable"
debug.log-file-not-found = "enable"
dir-listing.activate = "enable"
dir-listing.hide-dotfiles = "disable"
我的docker-compose.yml
文件包含:
lighttpd:
image: sebp/lighttpd
container_name: lighttpd
restart: unless-stopped
volumes:
- /srv/docker/lighttpd/lighttpd/etc/lighttpd.conf:/etc/lighttpd/lightpd.conf
- /srv/docker/lighttpd/lighttpd/log/error.log:/var/log/lighttpd/error.log
- /srv/docker/lighttpd/lighttpd/log/access.log:/var/log/lighttpd/access.log
- /var/www/lighttpd8081/html:/var/www/lighttpd8081/html
ports:
- "80"
tty: true
labels:
- "traefik.enable=true"
- "traefik.http.routers.lighttpd.rule=Host(`example.com`) && PathPrefix(`/.well-known/acme-challenge`)"
- "traefik.http.routers.lighttpd.entrypoints=web"
- "traefik.http.routers.lighttpd.tls=false"
networks:
- proxy
lighttpd
我可以从(通过)获得“404 文件未找到”信息。但我无法从和/或traefik
登录。lighttpd
access.log
error.log
我不知道为什么文件没有被提供lighttpd
,我也不知道为什么日志没有被写入lighttpd
。我可以通过lighttpd
运行docker compose up
而不使用-d
lighttpd | 172.18.0.4 example.com - [22/Oct/2022:13:08:11 +0000] "GET /.well-known/acme-challenge/indext.txt HTTP/1.1" 404 341 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15"
源文件存在:
root@snape:/srv/docker/traefik# ls -l /var/www/lighttpd8081/html/.well-known/acme-challenge/
total 8
-rw-r--r-- 1 root root 13 Oct 22 09:25 index.html
-rw-r--r-- 1 root root 13 Oct 22 12:50 index.txt
我猜我可能access.log
得不到error.log
,lighttpd
因为
tty: true
但如果我删除它,lighttpd
它根本就不会启动:
lighttpd | chmod: /dev/pts/0: No such file or directory
lighttpd | 2022-10-22 13:25:09: (configfile.c.1608) opening errorlog '/dev/pts/0' failed: Permission denied
lighttpd | 2022-10-22 13:25:09: (server.c.1564) Opening errorlog failed. Going down.