dunglas / frankenphp

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

Using laravel octane cannot use custom domain name #766

Closed ezekel closed 4 weeks ago

ezekel commented 4 weeks ago

What happened?

I tried to follow this https://laravel.com/docs/11.x/octane#frankenphp-via-docker, but it did not work when I access the site, https://api.myapp.local, Unable to connect.

I am using docker windows

FROM dunglas/frankenphp:latest

#https://github.com/exaco/laravel-octane-dockerfile/blob/main/FrankenPHP.Dockerfile reference ni

RUN apt-get update && apt-get install -y \
    curl \
    supervisor \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

#ENV NVM_DIR /home/${GetMyUsername}/.nvm
# Add additional PHP extensions here:
RUN install-php-extensions \
    pdo_mysql \
    gd \
    intl \
    zip \
    opcache\
    pcntl

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

COPY . /app

ENTRYPOINT ["php", "artisan", "octane:frankenphp"]
services:
      php:
        container_name: frankencontainer
        build:
            context: .
            dockerfile: ./docker/web.dockerfile
        image: frankenimage

        ports:
            - "80:80" # HTTP
            - "443:443" # HTTPS
            - "443:443/udp" # HTTP/3

        volumes:
            - caddy_data:/data
            - caddy_config:/config
            - ./:/app
        entrypoint: php artisan octane:frankenphp --max-requests=1 --host=api.myapp.local --port=80   --admin-port=2019 --https
        environment:
            - SERVER_NAME=api.myapp.local

Build Type

Docker (Debian Bookworm)

Worker Mode

Yes

Operating System

Other (tell us more in the description)

CPU Architecture

x86_64

PHP configuration

none

Relevant log output

Unable to connect
dunglas commented 4 weeks ago

You need to specify the domain name in the options: php artisan octane:frankenphp --host=my-domain-name --port=80 (add --https and change the port to 443 to enable HTTPS).

ezekel commented 3 weeks ago

@dunglas

Thanks, my container is spinning up, but I have problem when I check that octane is working by checking

image

am I missing something?

I also added to the .env

OCTANE_SERVER=frankenphp
OCTANE_HTTPS=true

Thank you in advance