Nginx Behind Traefik for PHP Support

Hey there,

Using Portainer as my admin interface with Traefik running alongside it, I'm having some issues trying to get InvoiceNinja setup. I'm trying to run it, but as it's PHP it requires Nginx, and in theory if I were to send the traffic through to the Nginx server and put it on a subdomain it should work right?

Well as of right now, my dashboard says nothing exists for the rules I've created, and I can't seem to get it to work or show up, any help would be appreciated, here's my Compose's

version: '3.7'

services:
  server:
    image: nginx
    restart: always
    env_file: env
    volumes:
      # Vhost configuration
      #- ./config/caddy/Caddyfile:/etc/caddy/Caddyfiledocker-com
      - ./config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
      - ./docker/app/public:/var/www/app/public:ro
    depends_on:
      - app
    ports:
      - "8069:8069"
    # Run webserver nginx on port 80
    # Feel free to modify depending what port is already occupied
    networks:
      - invoiceninja
    labels:
      - "traefik.enable=true"
      - "traefik.http.services.invoiceninja.loadbalancer.server.port=8069"
      - "traefik.http.routers.invoiceninja.rule=Host(`invoice.mydomain.com`)"
      # HTTPS
      - "traefik.http.routers.invoiceninja_https.entrypoints=websecure"
      - "traefik.http.routers.invoiceninja_https.tls=true"
      - "traefik.http.routers.invoiceninja_https.loadbalancer.server.port=8069"
      - "traefik.http.routers.invoiceninja_https.certresolver=leresolver"
      - "traefik.http.routers.invoiceninja_https.service=invoiceninja"
      - "traefik.http.routers.invoiceninja_https.rule=PathPrefix(`/`)"
      # HTTP just in case
      - "traefik.http.routers.invoiceninja_http.entrypoints=web"
      - "traefik.http.routers.invoiceninja_http.rule=PathPrefix(`/`)"
      - "traefik.http.routers.invoiceninja_http.service=invoiceninja"
  app:
    image: invoiceninja/invoiceninja:5
    env_file: env
    restart: always
    volumes:
      - ./config/hosts:/etc/hosts:ro
      - ./docker/app/public:/var/www/app/public:rw,delegated
      - ./docker/app/storage:/var/www/app/storage:rw,delegated
      - ./config/php/php.ini:/usr/local/etc/php/php.ini
      - ./config/php/php-cli.ini:/usr/local/etc/php/php-cli.ini

    depends_on:
      - db
    networks:
      - invoiceninja

  db:
    image: mysql:8
#    When running on ARM64 use MariaDB instead of MySQL
#    image: mariadb:10.4
#    For auto DB backups comment out image and use the build block below
#    build:
#      context: ./config/mysql
    ports:
      - "3305:3306"
    restart: always
    env_file: env
    volumes:
      - ./docker/mysql/data:/var/lib/mysql:rw,delegated

      # remove comments for next 4 lines if you want auto sql backups
      #- ./docker/mysql/bak:/backups:rw
      #- ./config/mysql/backup-script:/etc/cron.daily/daily:ro
      #- ./config/mysql/backup-script:/etc/cron.weekly/weekly:ro
      #- ./config/mysql/backup-script:/etc/cron.monthly/monthly:ro
    networks:
      - invoiceninja

  # THIS IS ONLY A VALID CONFIGURATION FOR IN 4. DO NOT USE FOR IN 5.
  # cron:
  #   image: invoiceninja/invoiceninja:alpine-4
  #   volumes:
      # - ./docker/app/public:/var/www/app/public:rw,delegated
      # - ./docker/app/storage:/var/www/app/storage:rw,delegated
      # - ./docker/app/public/logo:/var/www/app/public/logo:rw,delegated
  #   entrypoint: |
  #     /bin/sh -c 'sh -s <<EOF
  #     trap "break;exit" SIGHUP SIGINT SIGTERM
  #     sleep 300s
  #     while /bin/true; do
  #       ./artisan ninja:send-invoices
  #       ./artisan ninja:send-reminders
  #       sleep 1d
  #     done
  #     EOF'
  #   networks:
  #     - invoiceninja
  #

networks:
  invoiceninja:

Traefik is running default docker-compose as setup via portainer by listening on the docker.sock, my buddy said that was not the best method and I should do it via networking, but one step at a time.

Is there a proper way to do this without setting custom host rules or anything crazy? If I need to do that, what do I need to do? I'm amazed Traefik hasn't created a tut for this, seeing as how PHP is a pretty popular language

Regardless, thank you if you've read this, and thank you in advance for any help!

So far I have not come across a single Docker container with a web app that requires a separate web server in front of it.

Checking the doc it doesn’t state so, I would expect invoiceninja has everything included to serve the app.

This is the docker files for it, it states Nginx is required in the docker compose