machine: windows 10
Docker Toolbox version 18.03.0-ce
I’m having trouble running centos + php 7.1
Nginx works, but I can not run it with php.
when i execute http: // 192.168.99.100/index.php
return 404 Not Found
suceffull when i execute http: // 192.168.99.100/index.html
My Dockerfile:
FROM centos:centos7
# RUN yum install -y epel-release
RUN yum update -y
COPY ./nginx/nginx.repo /etc/yum.repos.d/nginx.repo
RUN yum install -y nginx
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
RUN yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN yum-config-manager --enable remi-php71
RUN yum install -y php php-fpm php-mbstring php-gd php-cli php-ldap php-json php-xml php-xmlrpc php-pecl-apcu php-pear-Net-Curl \
php-pear-Net-IMAP php-imap php-pecl-apcu-devel php-pear-MDB2-Driver-mysqli php-mysqlnd php-opcache php-pecl-zendopcache
COPY ./php/www.conf /etc/php-fpm.d/www.conf
#RUN systemctl enable nginx && systemctl start nginx
# start nginx
ENTRYPOINT ["/usr/sbin/nginx","-g","daemon off;"]
EXPOSE 80
EXPOSE 443
my default.conf
server {
listen 80;
server_name 192.168.99.100;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
my www.conf: change:
user = nginx
group = nginx
listen = 192.168.99.100:9000
my docker-compose.yml
version: '3'
services:
web:
image: nginx_gleads
build: ./
container_name: nginx_web
restart: always
ports:
- "80:80"
volumes:
- ./public:/usr/share/nginx/html