I'm currently stuck on a problem. I got a Server where i run multiple docker.
here i need to put have an php nginx one.
i got a docker-compose file like this :
version: 2
services:
web:
image: nginx:latest
ports:
- 'XXXX:80'
- 'XXXX:443'
volumes:
- ./code:./code
- ./site.conf:/etc/nginx/conf.d/default.conf
environnement:
- VIRTUAL_HOST:...
- LETSENCRYPT_HOST:....
- LETSENCRYPT_MAIL:....
networks:
- default
php:
build:
context: ./php
volumes:
- ./code:/code
networks:
- default
networks:
default:
external:
name:webproxy
My networks make me getting a automatique letsencrypt ssl
My dockerfile for php is :
FROM php:7.2-fpm
RUN apt-get update \
&& apt-get install -y --no-install-recommends libpq-dev \
&& docker-php-ext-install mysqli pdo_pgsql pdo_mysql
My config is :
server{
listen 80
index index.php index.html
server_name localhost
error_log /var/log/nginx/error.log
access_log /var/log/nginx/access.log
root /code
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php 9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info
}
}
My structure of folder is something like :
- imgFolder
- GameFolder
- index.html
- service.php
- imgFolder
- cssFolder
- desktop.html
- mobile.html
- main.css
All seems to be fine web i make my docker-compose compose up -d What i meen by all seems to be fine is : . HTML is well render . SSL is also well apply
But sometimes (not all the time but something like half time) my php file was not found on ajax request (got a 404 file not found in networks debug)
Did someone have an idea of why my service.php is sometimes not found ?
Dunno if it could help but i got exactly the same docker compose working alongside this one (different port) and there is no prob with my php files call.