我lighttpd
在 Ubuntu 上的 docker 容器中运行(作为我的设置中必须始终启动的服务traefik
)。我的docker-compose.yml
包含:
lighttpd:
image: sebp/lighttpd
container_name: lighttpd
restart: unless-stopped
volumes:
- /srv/docker/traefik/lighttpd/etc/lighttpd.conf:/etc/lighttpd/lighttpd.conf
- /srv/docker/traefik/lighttpd/log/error.log:/var/log/lighttpd/error.log
- /srv/docker/traefik/lighttpd/log/access.log:/var/log/lighttpd/access.log
- /var/www/miniserver/html/:/var/www/html/
ports:
- "80"
tty: true
labels:
- "traefik.enable=true"
- "traefik.http.routers.lighttpd.rule=Host(`foo.rna.nl`)"
- "traefik.http.routers.lighttpd.entrypoints=web"
- "traefik.http.routers.lighttpd.tls=false"
networks:
- proxy
lighttpd
工作,为我服务index.html
,但是:
# docker logs lighttpd
2022-10-29 12:13:55: (server.c.1568) server started (lighttpd/1.4.64)
我收到启动消息,但没有别的。当我将访问日志定向到文件时,我会在那里获得访问日志条目:
172.26.0.2 foo.rna.nl - [29/Oct/2022:11:53:02 +0000] "GET /index.html HTTP/1.1" 200 37 "-" "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"
如何将lighttpd
访问日志定向到标准输出?我尝试了这两个:
accesslog.filename = "/proc/self/fd/1"
accesslog.filename = "/dev/stdout"
我的完整lighttpd.conf
:
server.modules = (
"mod_indexfile",
"mod_access",
"mod_alias",
"mod_redirect",
"mod_accesslog",
)
server.document-root = "/var/www/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 = "/proc/self/fd/1"
#accesslog.filename = "/dev/stdout"
#accesslog.filename = "/var/log/lighttpd/access.log"