nginx site conf:
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www/example.com;
location / {
index index.php index.html;
}
location ~* \.php$ {
fastcgi_pass phpfpm:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
docker-compose.yml
version: "3"
services:
webserver:
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- ./wwwcontent:/var/www
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/conf/conf.d:/etc/nginx/conf.d
- ./ssl:/etc/ssl/
links:
- phpfpm
phpfpm:
image: php:7.4-fpm
volumes:
- ./wwwcontent:/var/www
expose:
- 9000
Below is the error I get:
connect() failed (113: No route to host) while connecting to upstream, client: 172.68.133.9, server: example.com, request: "GET /?5 HTTP/1.1", upstream: "fastcgi://172.24.0.2:9000", host: example.com