I have a docker setup for LEMP stack that I cloned from this repo.
Everything works nicely on my development machine running window 10, but when I push the image to docker hub and pull it on my VPS no matter what I do I always get this error:
[emerg] 1#1: host not found in upstream "php-fpm:9000" in /etc/nginx/conf.d/upstream.conf:1
This error is coming from two files.
First: From this Nginx Docker file
Here is the code:
RUN echo "upstream php-upstream { server ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" > /etc/nginx/conf.d/upstream.conf \
&& rm /etc/nginx/conf.d/default.conf
Second From this Nginx default.conf file
Here is the code:
location ~ \.php$ {
...
fastcgi_pass php-upstream;
...
}
I say these two files are the cause b/c there is no reference of php-upstream elsewhere.
I have tried every possible combination of adding/removing hosts, adding depends_on
, changing nginx, php version, disabling selinux but it just doesn't work. I always get the same error on production, but on local server everything works.