I have to create a Dockerfile which has to inherit FROM centos:7 by definition and install nginx and php and get it to show a PHP file.
My Dockerfile:
FROM centos:7
EXPOSE 80/tcp
RUN yum -y update
RUN yum -y install epel-release
RUN yum -y install nginx php php-fpm
RUN echo '<?php phpinfo();' > /var/www/demo/index.php
My problems:
- How can I make docker understand that nginy has to start when the container is created and started?
- How do I make nginx understand to use PHP?
For 1. all I know is that this is not possible with docker build.
For 2. I wanted to use tutorials but those are all wrong, because:
- there is no
/etc/nginx/sites-available
directory - there is no file called
snippets/fastcgi-php.conf
at any place to include in the nginx.conf
I have never worked with nginx before, so I have no idea where to start. No tutorial I found works, because all those files and folders don't exist. All I get is a 403 error page.
This the approach that I have you at some point, you have to install and to config the nginx on the Dockerfile and start it any time when you run the docker, set this on docker-entrypoint.sh
Dockerfile:
docker-entrypoint.sh:
Hope it helps!
I managed to keep the container alive by adding the following
Hope it will help you and the other colleagues