Skip to content

Commit 9bdbc3c

Browse files
CopilotNeunerlei
andcommitted
Fix PHP-FPM not reachable from nginx container (502 errors) (#266)
* Initial plan * fix: fix issues in nginx:app communication * Update nginx config comment to match implementation Co-authored-by: Neunerlei <22350956+Neunerlei@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: neunerlei <ich@neunerlei.eu> Co-authored-by: Neunerlei <22350956+Neunerlei@users.noreply.github.com>
1 parent b1b055e commit 9bdbc3c

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

_docker_production/nginx.default.conf

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ http {
4545
}
4646

4747
server {
48-
listen 443 ssl http2;
49-
listen [::]:443 ssl http2;
48+
listen 443 ssl;
49+
listen [::]:443 ssl;
50+
http2 on;
5051

5152
server_name _;
5253

5354
# Use the internal DNS resolver of Docker
54-
# First use the Docker embedded DNS server, then Google DNS and Cloudflare DNS as fallback
55-
resolver 127.0.0.11 8.8.8.8 1.1.1.1 valid=30s;
55+
resolver 127.0.0.11 valid=30s;
5656
resolver_timeout 5s;
5757

5858
root /var/www/html/public;
@@ -171,7 +171,8 @@ http {
171171
}
172172

173173
location ~ \.php$ {
174-
fastcgi_pass app:9000;
174+
set $upstream_app app:9000;
175+
fastcgi_pass $upstream_app;
175176
fastcgi_index index.php;
176177
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
177178
include fastcgi_params;
@@ -185,7 +186,8 @@ http {
185186
### Error Handling
186187
error_page 404 = @notfound;
187188
location @notfound {
188-
fastcgi_pass app:9000;
189+
set $upstream_app app:9000;
190+
fastcgi_pass $upstream_app;
189191
fastcgi_param SCRIPT_FILENAME /var/www/html/public/index.php;
190192
fastcgi_param REQUEST_URI /404;
191193
include fastcgi_params;

docker/php/config/fpm-pool.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error_log = /dev/stderr
1313
; (IPv6 and IPv4-mapped) on a specific port;
1414
; '/path/to/unix/socket' - to listen on a unix socket.
1515
; Note: This value is mandatory.
16-
listen = 127.0.0.1:9000
16+
listen = 9000
1717
user = www-data
1818
group = www-data
1919

@@ -74,4 +74,4 @@ ping.path = /fpm-ping
7474

7575
; The access log file
7676
; Default: not set
77-
access.log = /dev/null
77+
access.log = /dev/null

0 commit comments

Comments
 (0)