abiosoft/caddy-docker

PHP files are downloaded

sydev opened this issue · 0 comments

sydev commented

When I want to serve PHP files, they are downloaded. When I inspected the Header of the request I saw that the Content-Type is kind of wrong: application/x-httpd-php.

After I googled a little bit about this behaviour, I found out that this causes the browser to download it. Am I doing something wrong?

Caddyfile

0.0.0.0:80 {
  root /srv
  gzip
  log ../access.log

  proxy / web:8080 {
    transparent
  }

  fastcgi / 127.0.0.1:9000 php
  on startup php-fpm7
}

docker-compose.yml

version: "3.7"
services:
  db:
    image: mysql:8
    command: --default-authentication-plugin=mysql_native_password
    restart: unless-stopped
    env_file: .env
    environment:
      MYSQL_ROOT_PASSWORD: $DATABASE_PASSWORD
      MYSQL_DATABASE: $DATABASE_NAME
      MYSQL_USER: $DATABASE_USERNAME
      MYSQL_PASSWORD: $DATABASE_PASSWORD
    volumes:
      - ./data:/var/lib/mysql
    networks:
      - comingsoon
  web:
    restart: always
    build:
      context: ./web
      dockerfile: Dockerfile.dev
    expose:
      - 8080
    volumes:
      - ./web/src:/tmp/src
    networks: 
      - comingsoon
  server:
    image: abiosoft/caddy:php
    restart: unless-stopped
    volumes:
      - './.caddy:/root/.caddy'
      - ./web/Caddyfile:/etc/Caddyfile
      - ./web/src/form.php:/srv/form.php
    ports:
      - 7020:80
    depends_on:
      - db
      - web
    networks:
      - comingsoon

networks:
  comingsoon:
    driver: bridge