dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.96k stars 244 forks source link

Error Laravel Docker Deployment #1128

Closed oxzman closed 2 weeks ago

oxzman commented 3 weeks ago

What happened?

i am following this [https://frankenphp.dev/docs/production/](production docs) and want to deploy laravel app in VPS Ubuntu 20.04

i go to laravel root directory and create Dockerfile

FROM dunglas/frankenphp

RUN install-php-extensions \
    common \
    bcmatch \
    curl \
    mbstring \
    mysql \
    xml \
    zip 

# If you want to disable HTTPS, use this value instead:
ENV SERVER_NAME=:80
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY . /app

then i create compose.yaml inside laravel root app too

services:
  php:
    image: dunglas/frankenphp
    restart: always
    ports:
      - "80:80" # HTTP
    volumes:
      - caddy_data:/data
      - caddy_config:/config

# Volumes needed for Caddy certificates and configuration
volumes:
  caddy_data:
  caddy_config:

as i am using cloudflare, i think dont need https connection to VPS.

when i access it using public ip it showing error on browser:

ERR_CONNECTION_RESET

if access using domain pointing from cloudflare show error:

ERR_TOO_MANY_REDIRECTS

in cloudflare i am enable use HTTPS

Build Type

Docker (Alpine)

Worker Mode

Yes

Operating System

GNU/Linux

CPU Architecture

x86_64

PHP configuration

unable to find phpinfo(), since the server is not accessible

Relevant log output

No response

AlliBalliBaba commented 3 weeks ago

What are you seeing when doing docker compose up? Is the server starting regularly?

withinboredom commented 2 weeks ago

I'm not sure there is enough information here to help you out, but I'll give it a try.

ERR_CONNECTION_RESET may mean that you are trying to access an http:// url using https://. If I had a guess, your application is redirecting you from http:// to https:// which there isn't anything listening to https:// on your origin server.

ERR_TOO_MANY_REDIRECTS I'd recommend using something like curl to call the domain and see what it is redirecting you to. Browsers aren't really that great at this kind of debugging. I suspect you have a loop between https and http going on.

Closing this as it is most likely a result of application misconfiguration vs. a FrankenPHP issue.