-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Description
Error Message and Logs
I have a PHP application using nginx as a reverse proxy. I deploy it with Coolify and Docker Compose, and the main deployment works as expected. However, the preview deployment results in the following error:
error: nginx: [emerg] host not found in upstream "php_mm2" in /etc/nginx/conf.d/default.conf:16
Below are my current files
- DockerFile.nginx
FROM nginx:stable-alpine
WORKDIR /var/www/html/
COPY ./webroot /var/www/html
COPY ./docker/nginx/default.conf /etc/nginx/conf.d/default.conf
EXPOSE 80/tcp
- nginx.conf
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 /var/www/html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ˆ(.+\.php)(/.+)$;
fastcgi_pass php_mm2: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
services:
nginx_mm2:
build:
context: .
dockerfile: Dockerfile.nginx.staging
container_name: nginx_mm2
ports:
- "80"
depends_on:
- php_mm2
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:80/app/healthCheck" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
php_mm2:
build:
context: .
dockerfile: Dockerfile.staging
container_name: php_mm2
command: sh ./run_dependencies_staging.sh
ports:
- "9000"
Steps to Reproduce
- Active preview deployment
- Use docker-compose with an application and nginx containers
- Open a PR to trigger the preview Deployment
Example Repository URL
No response
Coolify Version
v4.0.0-beta.338
Are you using Coolify Cloud?
No (self-hosted)
Operating System and Version (self-hosted)
Ubuntu 22.04.4 LTS
Additional Information
The application and nginx containers are on the same network. I couldn’t debug nginx because it keeps restarting in a loop due to the error.
I think the reason is that during the preview deployment, the service name is changed with the addition of pr-{prId}.
lenzai, nktfh100, JensvandeWiel and aon
Metadata
Metadata
Assignees
Labels
No labels