0

我使用 dockerfile 部署Invoice Ninja,但无法访问 Invoice Ninja 页面。</p>

我尝试访问网址:http ://ninja.example.de:8080 /,但内容是Caddy 页面

码头工人-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 日志结果:我看不到错误 在此处输入图像描述

4

1 回答 1

0

刚遇到这个问题。您必须将 Caddyfile 中的一行更新为:

# Set this path to your site's directory.
root * /var/www/app/public

我通过取消注释这一行并编辑文件来做到这一点:

./config/caddy/Caddyfile:/etc/caddy/Caddyfile

现在,我正在使用 Docker for Windows,它一直在崩溃,说我正在尝试为文件查找文件夹,反之亦然。所以我只是自己制作了文件并从容器中复制了内容。

仅供参考,我的原始/默认文件如下所示:

# 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
于 2020-07-14T13:30:48.400 回答