Skip to content

Commit 7338d19

Browse files
committed
fix(nginx): ensure nginx starts only after nextcloud is up
Use docker-compose depends_on to guarantee nginx starts after nextcloud service is initialized. This removes the need for runtime DNS resolution and simplifies the nginx configuration: - Remove 'resolver' directive and 'zone' allocations - Simplify upstream blocks to use direct server references - Use depends_on: [nextcloud] instead of dynamic resolution - Keep eurooffice upstream but remove it from dependency chain (optional service) This ensures nginx starts with a resolvable upstream at startup, preventing any potential DNS resolution errors during container initialization. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent b6d4b7c commit 7338d19

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

‎.docker/nginx/nginx.conf‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,12 @@ http {
2828
set_real_ip_from 192.168.0.0/16;
2929
real_ip_header X-Real-IP;
3030

31-
resolver 127.0.0.11 valid=10s;
32-
3331
upstream php-backend {
34-
zone php-backend 64k;
35-
server nextcloud:9000 resolve;
32+
server nextcloud:9000;
3633
}
3734

3835
upstream eurooffice-backend {
39-
zone eurooffice-backend 64k;
40-
server eurooffice:80 resolve;
36+
server eurooffice:80;
4137
}
4238

4339
# Load HTTP and HTTPS server configurations

‎docker-compose.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ services:
6565
context: .docker
6666
dockerfile: Dockerfile.nginx
6767
restart: unless-stopped
68+
depends_on:
69+
- nextcloud
6870
volumes:
6971
- ./volumes/nextcloud:/var/www/html:ro
7072
- ./volumes/nginx/includes:/etc/nginx/conf.d/includes/

0 commit comments

Comments
 (0)