BirgerK / docker-apache-letsencrypt

This docker-image contains a simple Apache webserver and supports https-encryption by great Let's Encrypt certificates!
68 stars 47 forks source link

How to include PhP #15

Open rsnbusa opened 3 years ago

rsnbusa commented 3 years ago

Hi.

I have a dockerfile and docker-compose.yml file that starts an Apache-PHP-Node environment which has been tested to satisfaction.

The dockerfile is

FROM php:8.0-apache
COPY . /var/www/html
RUN docker-php-ext-install pdo pdo_mysql mysqli.  //need to access pdo apis
EXPOSE 80

The docker-compose file is

version: '3'

services:
    web-service:
        build: ./flowiot
        volumes: 
            - ./flowiot:/var/www/html
            - ./settings:/var/rsn
        ports:
            - 80:80
            - 443:443
    node-service:
        build: ./app
        volumes:
            - ./settings:/tmp/rsn
            - 

As you can see a Webserver is launched as well as a node app. And both apps are up and performing as expected.

When using your dockerfile, in the same directory using the original webserver dir (plus adding the Config folder) it does complete the installation and states that the webserver and node app are running.

Creating root_node-service_1 ... done
Creating root_web-service_1  ... done

The node app is working per usual and the webserver serves the html index page Ok. Since there is no PHP, it fails to perform its PHP duties. Also there is no ssl lock in the Browser.

Reviewing the webserver container via exec and looking at the etc/apache2/sites-available there is no WebServer Domain (flowiot.site) as set in the dockerfile ENV DOMAINS="flowiot.site".

ENV DEBIAN_FRONTEND noninteractive
ENV LETSENCRYPT_HOME /etc/letsencrypt
ENV DOMAINS "flowiot.site"
ENV WEBMASTER_MAIL "rsimpso........"

My questions are: 1. Did I miss something that I did not get a SSL from LetsEncrypt 1. How do I add PHP. I did try adding a FROM php:7.4 which HAS to be the first statement or your process exit with an error about the website directory. IF done first it does finish but no PHK (did exec to the webserver and did a php -v).

Thanks for any help. As u can imagine, Apache-PHP go very hand in hand for many older services.

Regards.

Robert

rsnbusa commented 3 years ago

Sorry forgot to state that there is no etc/letsencrypt directory

BirgerK commented 3 years ago

Hi, This is just a simple web-server for static content. No PHP.

Ofc one could expand my existing dockerfile and install just the apache-php-packages like described in one of the many tutorials: https://www.serverlab.ca/tutorials/linux/web-servers-linux/installing-php-for-apache-on-ubuntu/

But I won't do that, because I'm not spending time anymore on this project, sorry!

Did I miss something that I did not get a SSL from LetsEncrypt

Like said in the readme, ofc you need a configured VirtualHost, which uses that domain. Else Letsencrypt won't give you an y certs.

rsnbusa commented 3 years ago

Ok