Closed schmunk42 closed 1 year ago
Not really. FPM exposes itself either via socket and via port. nginx can read config parts from externally mounted FS so I don't see a technical reason why these two should reside in a single image.
nginx can read config parts from externally mounted FS
That's a huge NO-NO in production with Docker, btw.
I don't mean to put them on the same image, but to provide at least an example how to build one.
I've heard otherwise. There are many ways of get external FS into container. I didn't mean exactly mounting.
I've heard otherwise. There are many ways of get external FS into container.
You mean clustered filesystems with named volumes? Please share some details.
This is a matter of documentation. I agree to @samdark that we don't need a Nginx image. We can include a simple nginx.conf
in a docs
directory. Or maybe simply have it in the README
. We should leave decisions like the above to the developer and only provide a simple example.
Something like this:
https://github.com/codemix/yii2-dockerized/blob/master/nginx/nginx.conf
Coupled with a docker-compose.yml
example for how to wire up the app container with the nginx container.
Even more condensed, it's all about how to configure the Nginx image to include this config:
server {
server_name www.example.com;
charset UTF-8;
access_log /var/log/nginx/www.example.com.access.log;
error_log /var/log/nginx/www.example.com.error.log;
location / {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 30;
proxy_pass http://127.0.0.1:9000;
}
}
Creating a dedicate image for this is out of the scope of this project. Most devs may also want to tweak this config a little.
By request https://github.com/yiisoft/yii2-docker/issues/37#issuecomment-393080028
We're running nginx via forego like so https://github.com/dmstr/docker-php-yii2/blob/release/4.x/nginx/Dockerfile-fpm-nginx
This has to be proven a very stable setup. Although forego
is not very actively maintained it's still a very solid tool.
Having nginx in a separate container creates much more issues (ie. assets) than it solves, although it's "the Docker-way". But most other web-applications (in other languages) don't split that also.
I'd recommend to create a fpm-nginx
flavour.
For reference: https://github.com/dmstr/docker-php-yii2/blob/a9a6acb18e239ee5c4f1620a3db0c0cfa8feba86/nginx/Dockerfile-fpm-nginx
Implementation with supervisord
Hi!
I have a small problem with the image installing. I need a php 5.6 based yii2 docker image, to run a webserver on it, but in the docker-compose build command give an error:
checking Check for supported PHP versions... configure: error: not supported. Need a PHP version >= 7.0.0 and < 7.3.0 (found 5.6.40) ERROR: Service 'php' failed to build: The command '/bin/sh -c cd /tmp && git clone git://github.com/xdebug/xdebug.git && cd xdebug && git checkout 2.7.0beta1 && phpize && ./configure --enable-xdebug && make && make install && rm -rf /tmp/xdebug' returned a non-zero code: 1
Could anyone help for me, please?
Try an Apache 5.6 from here: https://hub.docker.com/r/yiisoftware/yii2-php/tags
so..will nginx image be provided? 😊
Do the ones from here https://github.com/dmstr/docker-php-yii2 work for you?
There's another image inbetween, but basically they are built upon the images from here.
We could add https://github.com/dmstr/docker-php-yii2/tree/master/nginx to this repo. CC: @yiisoft/core-developers
yes.it`s can achieved,but not official.
I've added an nginx flavour.
Since we're providing a specific Apache configuration and FPM would require a specific configuration for a webserver, very often
nginx
- we should think about providing such an image also.