我使用了一个dockerfile来部署Invoice Ninja,但无法访问“发票忍者”页面。
我尝试访问以下网址:http://ninja.example.de:8080/,但内容为Caddy page。
docker-compose.yml
version: '3.7'
services:
server:
image: caddy:alpine
restart: always
environment:
- APP_URL=http://ninja.example.de
volumes:
# Vhost configuration
#- ./config/caddy/Caddyfile:/etc/caddy/Caddyfile
- ./public:/var/invoiceninja/public
- ./storage:/var/invoiceninja/storage
depends_on:
- app
# Run webserver nginx on port 80
# Feel free to modify depending what port is already occupied
ports:
- "8080:80"
# - "443:443"
networks:
- invoiceninja
app:
image: invoiceninja/invoiceninja
restart: always
environment:
- APP_URL=ninja.example.de
- APP_KEY=base64:Iczfntb0PgJImdMW6PxMDeHi/v/h82yKv5xeYX3QvpU=
- MULTI_DB_ENABLED=false
- DB_HOST1=db
volumes:
- ./public:/var/invoiceninja/public
- ./storage:/var/invoiceninja/storage
depends_on:
- db
networks:
- invoiceninja
db:
image: mysql:5
restart: always
environment:
- MYSQL_ROOT_PASSWORD=mypassword
- MYSQL_USER=ninja
- MYSQL_PASSWORD=ninja
- MYSQL_DATABASE=db-ninja-01
volumes:
- ./mysql/data:/var/lib/mysql
networks:
- invoiceninja
# cron:
# cron is commented out by me
volumes:
mysql-data:
public:
storage:
networks:
invoiceninja:
docker-compose日志结果:我看不到错误
答案 0 :(得分:0)
只是有这个问题。 您必须将Caddyfile中的一行更新为:
# Set this path to your site's directory.
root * /var/www/app/public
我通过取消注释此行并编辑文件来做到这一点:
./config/caddy/Caddyfile:/etc/caddy/Caddyfile
现在,我正在使用Windows的Docker,并且它一直崩溃,表示我正在尝试查找文件的文件夹,反之亦然。 所以我只是自己制作了文件,然后从容器中复制了内容。
仅供参考,我的原始/默认文件如下:
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace the line below with your
# domain name.
:80
# Set this path to your site's directory.
root * /usr/share/caddy
# Enable the static file server.
file_server
# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080
# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile