Hi my NGinX and PHP container stack seem to be unable to communicate. Containers run with no errors however when I launch myip.com/index.php I get a nginx error 500 bad gateway. The error log says:
2024/07/29 17:44:59 [error] 29#29: *18 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.128.1, server: stock_manager, request: “GET / HTTP/1.1”, upstream: “fastcgi://192.168.128.2:9000”, host: “192.168.1.109:8080”
I’ve tried a few different configurations of my NGinX conf file but persistently get the same error.
My current NGinX conf file looks like this.
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /app;
index index.php index.html;
location / {
fastcgi_buffers 8 16k; # increase the buffer size for PHP-FTP
fastcgi_buffer_size 32k; # increase the buffer size for PHP-FTP
fastcgi_connect_timeout 60;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
try_files $uri $uri/ /index.php?$args;
}
location ~* .php$ {
fastcgi_pass PHP:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
# Logs for Nginx access and errors
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# deny access to .htaccess/.htpasswd files
location ~ /.ht {
deny all;
}
}